Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Al Hobbs
  • salvin francis

doubts about handling errors in html page

Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
    Bookmark Topic Watch Topic
  • New Topic