Hi all.
I'm in the process of writing a web application to validate new users
signing up to a service we provide. What I want to do is to take user input
via a standard HTML form, validate the information on the client side, and
if there are any errors redisplay the original page and inform the user of
the problems. I am currently thinking of the following way to do this:
1.) Use the input-taglib to construct the form elements to create a form on
form.jsp.
2.) Using the session-taglib, check the session when the form.jsp is
loaded.If the session contains alternative values for the defaults specfied
for the form, use them instead.
3.) Validation of the form will be carried out using a Servlet.
One problem I have with this is that I'm going to have to pass back
information to the page if there is an error to tell the user what they
didn't do correctly. I could simply pass a string in I guess and display
that in a pre-defined area on the jsp, but ideally I wanted to be able to
issue an input-by-input report on the problems, and have the error message
be displayed next to the incorrectly filled out form element. Do you think
this is feasible?
Does anyone have any comments on this proposed system? Also, any ideas on
the best way to report errors to the user? I really want to keep the .jsp
file as simple as possible, so I could easily get a web designer to change
and edit the pages look and feel - that is I want as little java code as
possible in the page. Ideally I'd like them to be ableto completely change
the look of the page without having to touch the non-html stuff.
sam
p.s.
Having just seen the article on form validation on javaworld, I would like
to of used that instead, but it doen't allow usage in a commerical product
:-(