开发者

stable parameters in jsp page [duplicate]

开发者 https://www.devze.com 2023-01-27 17:24 出处:网络
This question already has answers here: How can I retain HTML form field values in JSP after submitting form to Servlet?
This question already has answers here: How can I retain HTML form field values in JSP after submitting form to Servlet? (2 answers) Closed 7 years ago.

I build a web application using jsp. I send parameters from servlet to jsp in get method to display them in jsp page when I request it. the problem is : when I submit the form to servlet and开发者_运维问答 then return to jsp I have to send these parameter with the request. How can I make a stable parameters so, I have to send them once (in get method only) and maintain them in jsp.


You could access request parameters by ${param}.

<input name="foo" value="${param.foo}"> 

...

<input type="radio" name="bar" value="a" ${param.bar == 'a' ? 'checked' : ''}> 

...

<select name="baz"> 
<option value="b" ${param.baz == 'b' ? 'selected' : ''}>label</option> 

...

 <textarea name="boo">${param.boo}</textarea> 

This basically prints request.getParameter("foo") as input value. This way the submitted value will be retained in the input elements.

same question here How can I retain HTML form field values in JSP after submitting form to Servlet?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号