This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JSP and the fly likes Best Way to Validate the JSP form by using Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Best Way to Validate the JSP form by using Java" Watch "Best Way to Validate the JSP form by using Java" New topic
Author

Best Way to Validate the JSP form by using Java

YuenLian Wu
Ranch Hand

Joined: Nov 16, 2005
Posts: 73
Dear geeks,

I have some design questions regarding to the web form. My form has a lot of fields like Customer Name 1, Customer Password 1, Confirm Customer Password 1. I call those as a group. I have around 20 groups of that on my web form because of the user requirement. I feel so annoying that if I have to use the following validation code for each group,



The above code is good for few groups, however, I have a lot of such groups and I need to validate one by one. I feel so boring if I just copy paste one set of code and pase it to the jsp and rename the variable names.

ANy better way to implement that ? Myriad thanks

Transistor
[ April 26, 2006: Message edited by: YuenLian Wu ]
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6657
    
    5

Have you heard of the Struts framework ? Your values will automatically be mapped to variable names in classes. Do look into some example applications that use this.


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Jakarta Commons Validators is your best bet.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Best Way to Validate the JSP form by using Java
 
Similar Threads
ActionErrors with html:errors tag not displaying errors :-(
getting messages from MessageResources file
Validation
Log4j in struts
Validation