struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Kim <L...@netnumina.com>
Subject <action-mappings>
Date Wed, 04 Oct 2000 16:43:59 GMT
hi ,

The action.xml file has a mysterious attribute called "inputForm".
what is the meaning of this attribute?  I have put values in "inputForm" and
deleted them, and my application seems to work the same with our without
this attribute being present.

from the documentation, it does not say what the purpose of this attribute
is.  here is the excerpt and in this case, inputForm="/logon.jsp"

<!---- from documentation ------->

<action-mappings>
<action path="/logon" actionClass="org.apache.struts.example.LogonAction"
formAttribute="logonForm"
formClass="org.apache.struts.example.LogonForm" inputForm="/logon.jsp">
<forward name="success" path="/mainMenu.jsp"/>
<forward name="logon" path="/logon.jsp"/>
</action>
</action-mappings>

As you can see, this mapping matches the path /logon (actually, because the
example application uses extension mapping, the request URI you specify in a
JSP page would end in /logon.do). When a request that matches this path is
received, an instance of the LogonAction class will be created (the first
time only) and used. 

The controller servlet will look for a session scoped bean under key
logonForm, creating and saving a bean of the specified class if needed.
This action element also defines a logical name "success", which is used
within the LogonAction class to identify the page to be used when a user
successfully logs on. Using a logical name like this allows the action class
to be insulated from any changes in the page names that might occur due to a
site redesign.

There is a second forward element that is declared outside of any action, so
it is globally available to all actions. In this case, it defines a logical
name for the logon page. In your action code, when you call
mapping.findForward(), Struts first looks at the locally defined logical
names for this action. If it does not find one, it then searches the global
definitions for you automatically.

Mime
View raw message