|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.struts.action.Action
jp.terasoluna.fw.web.struts.actions.ActionEx
jp.terasoluna.fw.web.struts.actions.DispatchAction
public class DispatchAction
Performs distribution of forward destination of action.
Decides the forward path by using the request paramater.
Please note that the specifications differ from the DispatchAction and LookupDispatchAction
provided by Struts.
Perform the settings of request parameter key in Bean definition file as and when needed. (Default value is "event").
In the following definition file, request parameter key is set to custom-event.
Configuration of Bean definition file
<bean name="/dispatch" scope="prototype"
class="jp.terasoluna.fw.web.struts.actions.DispatchAction">
<property name="event">
<value>custom-event</value>
</property>
</bean>
Forward name is decided. The priority sequence is as follows:
Configuration of struts-config.xml
<action path="/dispatch"
name="_sampleForm"
scope="session"
input="/prev.jsp">
<forward name="regist" path="/userRegist.do"/>
<forward name="search" path="/userSearch.do"/>
<forward name="update" path="/userUpdate.do"/>
<forward name="decide" path="/prev.do"/>
<forward name="default" path="/prev.do"/>
</action>
Description example of JSP
Define "forward_" + logical forward name as the request parameter value.
...
<html:radio property="custom-event" value="forward_regist"/>
<html:radio property="custom-event" value="forward_search"/>
<html:radio property="custom-event" value="forward_update"/>
<html:radio property="custom-event" value="forward_#input"/>
<html:submit property="forward_decide" value="Decide"/>
<html:submit value="Back"/>
...
The forward path for the respective operation is as follows.
Field Summary | |
---|---|
private java.lang.String |
event
Poperty name that indicates foward path. |
private static java.lang.String |
FORWARD_DEFAULT
Logical forward name of default forward path when there was no forward indicator in the request parameter. |
private static java.lang.String |
FORWARD_PREFIX
Prefix of request parameter key for identifying the forward indicator. |
private static org.apache.commons.logging.Log |
log
Log class. |
Fields inherited from class jp.terasoluna.fw.web.struts.actions.ActionEx |
---|
FORWARD_TXTOKEN_ERROR |
Fields inherited from class org.apache.struts.action.Action |
---|
defaultLocale, servlet |
Constructor Summary | |
---|---|
DispatchAction()
|
Method Summary | |
---|---|
protected org.apache.struts.action.ActionForward |
cancelled(org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionForm form,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Decides the forward path when cancellation flag is set in the request. At the time cancelling action forward, since ActionForward is returned as null, the forward path should be implemented by overriding the method in the sub class of this class. |
protected java.lang.String |
doDetermineForward(java.util.Map params,
java.lang.String event)
Dispatch the forward action based on the request parameter. When the params is null, returns default string. |
org.apache.struts.action.ActionForward |
doExecute(org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionForm form,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Performs the distribution of forward path. |
protected boolean |
exists(java.util.Map params,
java.lang.String name)
Check if the parameter with the specified name exists in the request parameter. |
void |
setEvent(java.lang.String value)
Sets the property name that indicates forward path. |
Methods inherited from class jp.terasoluna.fw.web.struts.actions.ActionEx |
---|
addErrors, addMessages, execute, isSaveToken, isTokenCheck, processTokenCheck, setSaveToken, setTokenCheck |
Methods inherited from class org.apache.struts.action.Action |
---|
addErrors, addMessages, execute, generateToken, getDataSource, getDataSource, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static org.apache.commons.logging.Log log
private static final java.lang.String FORWARD_DEFAULT
private static final java.lang.String FORWARD_PREFIX
private java.lang.String event
Constructor Detail |
---|
public DispatchAction()
Method Detail |
---|
public void setEvent(java.lang.String value)
value
- Forward path property name public org.apache.struts.action.ActionForward doExecute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
Once the action is forwarded, it deletes server blockage flag.
The actual forward path is decided by doDetamineForward().
doExecute
in class ActionEx
mapping
- Action mappingform
- Action formreq
- HTTP
Requestres
- HTTP
Response
protected java.lang.String doDetermineForward(java.util.Map params, java.lang.String event)
params
- Request parameter(Map format)event
- Event name specified in action mapping
protected boolean exists(java.util.Map params, java.lang.String name)
params
- Request parameter(MAp format)name
- Request parameter name
true
protected org.apache.struts.action.ActionForward cancelled(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
mapping
- Action mappingform
- Action formrequest
- HTTP requestresponse
- HTTP response
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |