Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Joe Ess
  • salvin francis
  • fred rosenberger

doubts about handling errors in html page

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..
Posts: 13411
Firefox Browser VI Editor Redhat
  • 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.
Let nothing stop you! Not even this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!