java - How to re-populate form fields on a jsp page after failed server validation -
i have simple java mvc web application , using servlet handle form validation. if form validated, request forwarded appropriate view. however, if form fails validation, request forwarded form, displays appropriate error message(s).
my question -- efficient way re-populate of form fields data entered in form user?
i not using mvc framework, simple httpservlets controller .jsp view.
the easiest , least effort use
<input name="foo" type="text" value="${param.foo}"/>
this should default "" when user first visits form.
a little more can done create custom tag binds request. not solution looking for.
edit: may want use <c:out value="${param.foo}"/>
protect against xss attack.
Comments
Post a Comment