Sample config
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">
<struts-config>
<form-beans>
<form-bean name="addForm" type="com.xx.yyy.AddForm"/>
<form-bean name="deleteForm" type="com.xx.yyy.DeleteForm"/>
</form-beans>
<action-mappings>
<action path="/add"
type="org.springframework.web.struts.DelegatingActionProxy" name="addForm"
scope="session" validate="true" input="xx.yy..index">
<forward name="success" path="success path for add"/>
<forward name="failure" path="failure path for add"/>
</action>
<action path="/delete"
type="org.springframework.web.struts.DelegatingActionProxy" name="deleteForm"
parameter="method" scope="request" validate="true" input=".register">
<forward name="success" path="success path for delete"/>
<forward name="failure" path="failure path for delete"/>
</action>
</action-mappings>
<message-resources parameter="ApplicationResources"/>
<message-resources key="keyerrors" parameter="xxxErrorResources"/>
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/xxx/validator-rules.xml,/WEB-INF/xxx/validation.xml"/>
</plug-in>
<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config"
value="/WEB-INF/tiles-defs.xml,/WEB-INF/xxx/tiles-xxx-defs.xml"/>
<set-property property="moduleAware" value="true"/>
</plug-in>
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="/WEB-INF/xxx/action-servlet.xml"/>
<!-- -->
</plug-in>
</struts-config>
Note the following
1. This is a typical example modify according to your need
2. Name of the form is addForm and deleteForm in the xml above (You can
change as you want)
3. Ask questions I will answer them all (not much work to do today)
4. Path in action mappings can be tile if that is the case you will need a
tile definition as well or a jsp page(not a good idea to use jsp)
5. Optional: good idea to have all these xml files per struts module
Hope that helps
Manoj
-----Original Message-----
From: Maya menon [mailto:cc]
Sent: 01 June 2006 16:46
To: user@struts.apache.org
Subject: Global forwards and actions
All,
I want to understand this better:
Say, I have one form , addDetails.jsp and another deleteDetails.jsp
addDetails.jsp when submitted should call AddAction and deleteDetails should
call Deleteaction.
In adddetails I have <form action="add.do"/> and in delete I have <form
action="delete.do"/>
Now, what all entries do I need in struts-config.xml for these to be
forwarded to the correct action classes ?
thanks
Maya
---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates
starting at 1ยข/min.