Whew, ok, so after 7 hours of debugging, we figured it out.

If you want to use validation and you need to use a custom form bean (that extends the validator form) that can pre-populate some form elements while leaving others alone you need to specify the 'validate="false"' attribute on the action element in the struts config file that pre-populates the form bean used by the JSP. Otherwise, the validator will try to validate the form bean before the JSP is even rendered and when the JSP is rendered, you'll get all the validation errors.

Hope this can help someone else...

-Adam

Adam Gordon wrote:
I've been racking my brains for several hours now and can't seem to find the exact way to configure struts for validation when using tiles and a form bean. My problem is when the URI hits Index.do, so for the first action mapping.

Here are the snippets from my config files:

validation:

   <formset>
     <form name="inviteFormBean">
      ...
      ...
   <formset>


struts:

   <form-beans>
       <form-bean name="inviteFormBean"
                  type="the.path.to.MyFormBean"/>
   </form-beans>

   <action-mappings>
       <action path="/Index"
               type="the.path.to.MyAction"
               name="inviteFormBean"
               input="inviteFormTile"/>

       <action path="/InviteSubmit"
               name="inviteFormBean"
               input="inviteFormTile"
               type="the.path.to.AnotherAction"
               parameter="method">
         <forward name="display" path="inviteSentTile" />
       </action>
      ...
   <action-mappings>

tiles:

 <definition name="inviteFormTile">
   ...
 </definition>

---
First, I'm only using server-side validation because we don't want the J/S alert window.

The bean "FormBean" extends ValidatorForm though I've also tried ValidatorActionForm. I've also played with the "parameter" attribute on the "action" element for the Index action mapping. The behavior I'm seeing is that either MyAction's execute(...) method doesn't even get executed and the validator validates the form in the JSP as it's rendered (not at submission time), OR, MyAction's execute(...) method is called but then the form isn't validated on submission.

If more info is needed, please let me know.  Any ideas?

Thanks,

-Adam

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to