How to redisplay the value in html page
I have a signup.jsp page, there are some input boxes of html on this page, there is a input box for email-id also, when i submit form after fill up there is server side checking of email address, if email address already exist in database then signup.jsp page will redered again, then i want all the value should be dispalyed in a开发者_StackOverflow社区ll the input boxes that the user filled before submitting the form.
Appropriate help will be appreciable...
<input type="text" name="email" value="<c:out value='${param.email}'/>"/>
This displays the value of the email
request parameter in the email text box. Initially, this parameter won't exist, so the text box will be blank.
Note the use of the <c:out>
JSTL tag, which allows HTML-escaping the value of the parameter.
Your form parameters should be wrapped in a element. When submitted they will be sent to server using request parameters.
Then in your jsp file you need to render those request parameters in the places they should appear. Initially they will be empty, so user will see them rendered as initial blank values to fill.
The better approach is that you have to create a bean with session scope using <jsp:useBean/>
, on server code update the bean's attributes and in view (jsp) page embed bean's property value to the <input/>
attributes.
<form method='post' action='your_action'>
<input type='text' value="<c:out value='${bean.name}'/>" name='name'/>
</form>
精彩评论