You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Gregory F. March" <ma...@gfm.net> on 2003/06/09 19:47:17 UTC

Argh! [was Re: DynaValidatorForm setup]

On Jun 6, 2003, "Barry Volpe" <st...@childrencare.com>  wrote:

 |I was able to piece it all together using the
 |struts-validator.war file that comes in the

Barry,

Thanks for that write up.  Looking at that war, I set my app up
similarly, but I am having a very frustrating problem.

When my form tag in the validation.xml file points to (name=) my
DynaValidatorForm in my struts-config.xml, submitting that form yields
an error 404 - not available.  Changing the form method to GET, the
url is ...<formname>.do... after the submit.  Turning off the
validation (by changing the name in the validation.xml to something
else) and submitting the form yields a url that came from the action's
forward tag.

I just don't have enough experience with struts to be able to
understand what is happening (read: HELP!).  I suspect that the
validation is returning something that I am not handling, but I can't
figure out what it is so that I can handle it.  Below are the code
snippets.

Thanks...

/greg (clumps of hair in my white-knuckled fists!)

--
Gregory F. March    -=-    http://www.gfm.net:81/~march    -=-    AIM:GfmNet

struts-config.xml:
    <form-bean
      name="LOCCreateForm"
      type="org.apache.struts.validator.DynaValidatorForm">

      <form-property name="CompanyOrDivisionID" type="java.lang.String"/>
      <form-property name="Destination"         type="java.lang.String"/>
      <form-property name="CRN"                 type="java.lang.String"/>
      <form-property name="ApplicantID"         type="java.lang.String"/>
...
  <action
      path="/SaveTWSItem"
      type="com.mycompany.web.action.SaveTWSItemAction"
      scope="session"
      name="LOCCreateForm"
      validate="true"
      input="/LOCCreateParticipants.jsp"
      parameter="action">

      <forward
          name="Success"
          path="/mainpage/mainpage.jsp"
          redirect="true" />

      <forward
          name="Failure"
          path="/errors/general.jsp"
          redirect="true" />
...

validation.xml:

<form-validation>
  <formset>
    <form name="LOCCreateForm">
      <field
        property="CRN"
        depends="required,mask">
        <arg0 key="loc.create.crn"/>
        <var>
          <var-name>mask</var-name>
          <var-value>^[0-9]*$</var-value>
        </var>
      </field>
    </form>
  </formset>
</form-validation>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Argh! [was Re: DynaValidatorForm setup]

Posted by Kevin Robair <kr...@yahoo.com>.
Make sure "/LOCCreateParticipants.jsp" is in the root
of your web app. (Sorry, I know that is obvious, but I
included it just in case)

In your struts-config.xml, check to see if you have
this:

<controller>
    <!-- The "input" parameter on "action" elements is
the name of a local or global "forward" rather than a
subapp-relative path -->
    <set-property property="inputForward" value="true"
 
    />
</controller>

If so, create a global forward:

<forward name="CreateParticipants"
path=""/LOCCreateParticipants.jsp"" redirect="false"
/>

and change Action so that input="CreateParticipants"


-Kevin

--- "Gregory F. March" <ma...@gfm.net> wrote:
> 
> On Jun 6, 2003, "Barry Volpe"
> <st...@childrencare.com>  wrote:
> 
>  |I was able to piece it all together using the
>  |struts-validator.war file that comes in the
> 
> Barry,
> 
> Thanks for that write up.  Looking at that war, I
> set my app up
> similarly, but I am having a very frustrating
> problem.
> 
> When my form tag in the validation.xml file points
> to (name=) my
> DynaValidatorForm in my struts-config.xml,
> submitting that form yields
> an error 404 - not available.  Changing the form
> method to GET, the
> url is ...<formname>.do... after the submit. 
> Turning off the
> validation (by changing the name in the
> validation.xml to something
> else) and submitting the form yields a url that came
> from the action's
> forward tag.
> 
> I just don't have enough experience with struts to
> be able to
> understand what is happening (read: HELP!).  I
> suspect that the
> validation is returning something that I am not
> handling, but I can't
> figure out what it is so that I can handle it. 
> Below are the code
> snippets.
> 
> Thanks...
> 
> /greg (clumps of hair in my white-knuckled fists!)
> 
> --
> Gregory F. March    -=-   
> http://www.gfm.net:81/~march    -=-    AIM:GfmNet
> 
> struts-config.xml:
>     <form-bean
>       name="LOCCreateForm"
>      
>
type="org.apache.struts.validator.DynaValidatorForm">
> 
>       <form-property name="CompanyOrDivisionID"
> type="java.lang.String"/>
>       <form-property name="Destination"        
> type="java.lang.String"/>
>       <form-property name="CRN"                
> type="java.lang.String"/>
>       <form-property name="ApplicantID"        
> type="java.lang.String"/>
> ...
>   <action
>       path="/SaveTWSItem"
>      
> type="com.mycompany.web.action.SaveTWSItemAction"
>       scope="session"
>       name="LOCCreateForm"
>       validate="true"
>       input="/LOCCreateParticipants.jsp"
>       parameter="action">
> 
>       <forward
>           name="Success"
>           path="/mainpage/mainpage.jsp"
>           redirect="true" />
> 
>       <forward
>           name="Failure"
>           path="/errors/general.jsp"
>           redirect="true" />
> ...
> 
> validation.xml:
> 
> <form-validation>
>   <formset>
>     <form name="LOCCreateForm">
>       <field
>         property="CRN"
>         depends="required,mask">
>         <arg0 key="loc.create.crn"/>
>         <var>
>           <var-name>mask</var-name>
>           <var-value>^[0-9]*$</var-value>
>         </var>
>       </field>
>     </form>
>   </formset>
> </form-validation>
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org