The ActionMapping Implementation in Struts Framework

The ActionMapping Implementation in Struts Framework

Previous Home Next

 

ActionMapping object describes an Action instance to the ActionServlet.It represent the information that uniquely define an instance of a particular action class.

 
An action mapping is a configuration file entry that associates an action name with an action.
An action mapping can contain a reference to a form bean that the action can use and can additionally define a list of local forwards .

Example :-

struts-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC 
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" 
"http://struts.apache.org/dtds/struts-config_1_3.dtd">
<struts-config>
<action-mappings>
<action path="/login" type="com.r4r.struts.LoginAction" name="loginForm">
<forward name="success" path="/success.jsp"/>
<forward name="error" path="/error.jsp"/>
</action>
</action-mappings>
</struts-config> 

There are following attributes in action element :-

1.path:- This attribtes is application context-relative path to the action.
2.type:- This attributes represent the own Action classname that extends Action class.
3.name:- Name represent your Form bean element to use with this action


Previous Home Next