This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Darcy DeClute's Scrum Master Certification Guide: The Definitive Resource for Passing the CSM and PSM Exams and have Darcy DeClute on-line!
See this thread for details.
  • 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 ...
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown

STRUTS: client-side validation in jsp using DynaValidatorForm

Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am supposed to work on struts on as project and it is like learning a crash course and work the next day.
In Struts 1.1 enviroment, I am using DynaValidatorForm to create a bean form and then perform validation.
1. I write a DynaValidatorForm definition in struts-config.xml
2. I write xml for action so that when / in invoked by a jsp form, the form data is put into the QuoteDetailsBean.
3. add the plugin script for ValidatorPlugIn

xml fragment from struts-config:

Now I write a validation code for note that I can write the validation code with
<form name="QuoteDetailsBean"> but this form bean is shared by many jsp, so i am using the name of the action
(getQuotes) as the name of the form in the validation.xml.
So far this looks okay, as I am going by some example.

xml fragment from validation.xml:

Now I write the JSP. I use the <html:javascript> tag to allow front-end validation based on the xml in validation.xml.
The jsp code:

Does this looks okay. I wrote so far based on some tutorials n help online.
Now when I open the JSP and then do a submit, there is no validation (I tried by submitting with empty forename and surname. I mean i could invoke the action class and the invoke class
redirects(forwards) to the appropriate path. so the code works fine except validation is not done

Q1. So what should i do more to get client-side validation?
What actually happens in client-side validation? does a pop up alert appears?
nothing happens so far in my case.

Q2. What should I do more for server side validation. Since the form is incomplete, what happens?
I thought the same form returns and the error messages are printed in the jsp page since i have the <html:errors />
tag just below the <body> tag.

The action class is pretty simple so far:

Please help me out. I think I am missing something which i need to do

You got style baby! More than this tiny ad:
a bit of art, as a gift, the permaculture playing cards
    Bookmark Topic Watch Topic
  • New Topic