I am new to struts, and while I've found the solutions to most of my problems, this one has had me stumped for days.
The form validation errors are displayed when the form is initially displayed, so before the user has even had an opportunity to enter data that would need to be validated. I've completed a test struts application, and I do not have this problem in the test app.
I don't think it makes a difference, but in this application, I'm using LookupDispatchAction, instead of Action. Aside from that difference, the only significant difference is that my current app uses filters to set up some application support.
Here is the relevant part of my struts-config.xml:
I am new to struts, but I believe the problem is a logic issue. I am assuming the link below is contained in the welcome.jsp page.
So when the link above is clicked a new ActionForm is created, based on your configuration that would be object "ManageContactForm", this object should be populated with the parameters from the request object, but since there were no parameters passed to the ActionForm, the Action object created from the class "edu.ohio.struts.action.ManageContactAction", would return invalid information.
Basically your ActionForm object was created without any information and then passed to the Action object for processing. You need to capture the information from the Form first, then pass it to the ActionForm.
My suggestion is to create a global forwards and call it something like:
And then change the link in the welcome.jsp to :
Like I said, I am new, so maybe this can share some light on the situation.
Joined: Oct 25, 2005
That fixed it! I had an idea of what was happening, but I wasn't sure how to fix it. Thanks for the example. I am very grateful.
subject: html:errors displayed before form is submitted