使用javascript将表单中的值传递到JSP页面 [英] Passing values in a form using javascript to a JSP page

查看:203
本文介绍了使用javascript将表单中的值传递到JSP页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨所有


in jsp

我创建了一个组合框,我编写了一个java脚本来从组合框中选择值。

当我从组合框中选择一个值时,它应该转到另一个jsp页面

因为我将所选值作为字符串与java脚本中的url一起传递。

喜欢< a href = ..........?<%= val%>

然后我怎么能把这个值带到另一个jsp页面。


请任何人都可以帮助我.....

对我来说很紧迫

解决方案


嗨所有


在jsp中

i创建了一个组合框,我写了一个java用于从组合框中选择值的脚本。

当我从组合框中选择一个值时,它应该转到另一个jsp页面

因为我将所选值作为字符串与java脚本中的url一起传递。

喜欢< a href = ..........?<%= val%>

然后我怎么能把这个值带到另一个jsp页面。


请任何人都可以帮助我.....

对我来说很紧急



你可以在隐藏的输入中设置值,并使用request.getParameter(" inputName")在下一个JSP中获取它;

因为你可以提交它更干净使用post方法的表单。



您可以在隐藏输入中设置值,并使用request.getParameter在下一个JSP中获取它(" inputName");

因为你可以使用post方法提交表单,所以它更干净。



我在哪里可以写出隐藏的输入值

你能为它提供一个简单的代码吗


< blockquote>


我在哪里可以写出隐藏的输入值

你可以提供一个简单的代码吗



您需要将其放在提交页面的JSP上的表单上。你在页面上有表格吗?


hi all

in jsp
i created a combo box and i written a java script to select values from combo box.
when i select a value from combo box it should go to the another jsp page
for that i passed the selected value as a string along with the url in java script.
like <a href=..........?<%=val%>
then how can i get this value into another jsp page.

please any body can help me.....
its urgent for me

解决方案

hi all

in jsp
i created a combo box and i written a java script to select values from combo box.
when i select a value from combo box it should go to the another jsp page
for that i passed the selected value as a string along with the url in java script.
like <a href=..........?<%=val%>
then how can i get this value into another jsp page.

please any body can help me.....
its urgent for me

You can set the value in a hidden input and get it in the next JSP using request.getParameter("inputName");
It''s cleaner that way as you can submit the form using the post method.


You can set the value in a hidden input and get it in the next JSP using request.getParameter("inputName");
It''s cleaner that way as you can submit the form using the post method.


where can i write that hidden input value
can you please provide a simple code for it


where can i write that hidden input value
can you please provide a simple code for it

You need to put that on a form on the JSP that is submitting the page. Do you have a form on the page?


这篇关于使用javascript将表单中的值传递到JSP页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆