On Sun, 25 Mar 2001, Yao, Guang wrote:

> Hi,
> 
> I have a question about the function of "input" and "path" attributes in
> struts-config.xml:
> 
> I developed a JSP file(packageMod.jsp) which contains one form. The action
> of this form is defined as "packageSave" in the <html:form> tag:
> 
> <html:form action="/packageSave">
> 
> The following is the corresponding action definition in struts-config.xml:
> 
> ...
> <action   path="/packageSave"
>                 type="mytest.SavePackageAction"
>                 name="PackageForm"
>                 scope="request"
>                 validate="true"
>                 input="/packageMod.jsp">
> ...
> 
> It seems to me that the "input" attribute in above definition is not
> necessary, because according to the <html:form> tag, the form will be
> submitted to "packageSave", and then the ActionServlet will find the right
> mapping action through its "path" attribute.
> 
> To test if this is true, I took out the "input" attribute from
> struts-config.xml, restarted the Struts and the application did still work. 
> 
> So, can anybody tell me when the "input" attribute is needed?
> 

The application will still work, but the existence of the
"input" attribute triggers calling the validate() method and returning to
the input form if there were any validation errors.  Without the
"input" attribute, your application will be expected to deal with this
itself.

> Thanks in advance,
> 
> - Guang
> 
Craig


Reply via email to