English 中文(简体)
如何将价值从客户一方传递给服务器方面?
原标题:How to pass values from client side to server side?

我的情况是,将价值从jsp到servlet的行动类别。 此前,我们曾使用过它。

<input type="hidden" id="name" value="manoj" />

我们在行动类别中采用<代码>request.getPara amount(“名称”。 但现在,我们就没有像过去那样的价值。

"Hi

 i am
 
 Manoj". 

Since it has new line included in the string we couldn t take it like this to action. So how I can take value like this to action or is there any way other than hidden input?

感谢。

问题回答

如果你想要从一个隐蔽的输入领域把新线包括在内,你就不得不逃脱。 你们要么能够利用《html》的特性代码参考资料或《URL》来逃避外地价值。

新线路的价值应为<代码>&#10;。 以及运输回报的编号&#13;

其他替代物

  • You could save the value of the parameter as to a session attribute or to a cookie and not pass it as a http parameter at all
  • You could include the value in a textarea that is hidden using CSS
  • You could include the value somewhere else in the document and include it to the form during the onsubmit handler (yuck)




相关问题
Convert typed-in Text to lowercase

I ve got an index.jsp with [snip] <% String name = request.getParameter("name"); String pass = request.getParameter("pass"); String globalname = "webeng"; String globalpass = "2009"; ...

session transfer issue from Tomcat to ASP.Net

I am using Tomcat to host JSP and using IIS 7.0 to host aspx (C# + .Net 3.5 + VSTS 2008), and I have some session transfer issue from JSP page to ASPX page. JSP page is in one domain and all other ...

Setting the default value in Struts2

I am setting the value(kind of default value) for a drop down select value from action class in a page(given below). When the page loads the value is beig displayed but the other elements of the ...

Evaluate dynamically constructed JSP at runtime

I have a requirement where in the JSP page itself is created by the user and stored in the database. When viewing results we need to render this JSP to the client, evaluating all tags inside this JSP. ...

How to Pack/Encrypt/Unpack/Decrypt a bunch of files in Java?

I m essentially trying to do the following on a Java/JSP-driven web site: User supplies a password Password is used to build a strongly-encrypted archive file (zip, or anything else) containing a ...

JSP exception - class not found (tomcat)

I m setting up an existing application on a new Tomcat 5.5 server connecting to a Postgres database (running on Debian Lenny). When I access it I get a series of stack traces with the following root ...

ArrayList to Table in JSP

I have an ArrayList and i am trying to display it in a table ..... ArrayList rows = .... ..... <table cellspacing="1" cellpadding="4" border="3"> <tr> <TH>...

热门标签