Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

doubts about handling errors in html page  RSS feed

 
Raveendra Mutyala
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,
i had an html page which is submitted with values and due to errors we are redirecting the page back to the same html page with some warnings appended to it. i wanted to fill all the details which are correct in the previous request except the errors fields . how can we do that in struts or jsp.

Waiting for ur reply..
bye..
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Struts has an entire component devoted to form validation.
The best place to learn about it is the Struts documentation.
There is also a Struts forum on this site if you have specific questions about it.

There are several approaches you can take if you're coding your own solution.
I do this by creating a bean that has a property for each field in the form.
If the validation fails, I bind the bean to request scope and forward back to the JSP with the form.

You can use either EL:
<input type="text" name="first_name" value="${formBean.firstName}" />

or for older apps, the xml syntax
<input type="text" name="first_name" value="<jsp:getProperty name="formBean" property="firstName" />" />
to populate the fields.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!