Strut-config.xml For requests that hit URL=“/logon” The frame work will invoke execute() on an instance of class com.codementor.LogonAction Store request parameters in form variable “LogonForm” which is defined in another location in the xml document. If the logical name returned by perform() is “failure” go to page “/failure.jsp” If the Logical name returned by perform() is “success” go to “/success.jsp” <action path=" /logon “ type= “ com.codementor.LogonAction ” name=" LogonForm " <forward name=" failure " path=" /failure.jsp " /> <forward name=" success " path=" /success.jsp " /> </action>
To provide clarity when working with multiple nested properties
To provide script variable for included JSP pages.
Does NOT create an instance of a bean
It provides access to a bean in scope
Don’t use to define a form bean to a new script variable name
Bean:Define <bean:define id=“employeeList“ name=“selectEmployeesForm“ property=“employeeList“ type="java.util.Collection"/> Defines a referenceable variable named employeeList which is assigned that value Of the property employeeList in the form Bean. Collection employeeList = selectEmployeesForm.getEmployeeList();
Preferred order to provide a link in Struts
Uses the defined global forwards from the struts configuration file.
Bean:Write JSP Equivalent: <%= modelForm.getClientName() %> If the named object is an object you do not have to define a property Ex: <bean:write name=“id” /> This commonly happens with a bean define or an id assigned in an iterator
Displaying HTML on HTML
Struts will not display the source of html of an html page by default
Use the bean:write with the filter set to false.
Used to retrieve a property from a configured property file.
We’ll look at this in detail in the Internationalization section.
<bean:message key=“ user.message”/>
Can be used in combination with a bean (such as a form bean)
In this case the property clientInfo, of the modelForm bean has the key to the resource bundle.
The value of clientInfo is NOT displayed
It is used to lookup the value in the resource bundle which is displayed.