|
||||||||||
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
public abstract class ActionEx
Action class.
Log output function and transaction token check function are added in the Action
of Struts.
To use these functions, inherit this class.
To use this class, create the subclass that overrides doExecute() method
and set the class name in the type parameter of <action> element in
struts-config.xml.
Transaction token check is the function which prevents the duplication of submit.
Duplicate submit is performed by pressing the submit button twice or using "Back" button
of the browser.
Following settings are required to perform transaction token check.
Configuration example of Bean definition file in subclass LogoffAction
<bean name="/admin/Logout" scope="prototype"
class="jp.terasoluna.fw.web.struts.actions.LogoffAction">
<property property="tokenCheck">
<value>true</value>
</property>
<property property="saveToken">
<value>false</value>
</property>
</bean>
Configuration example of struts-config.xml in subclass LogoffAction
When the module is set in the "forward" element by appending the "/" slash at the beginning of
the path, it is possible to make the modulewise transition by using the relative path.
<action path="/admin/Logout"
name="logonSampleForm"
scope="session"
parameter="/sub/logout.jsp">
<forward name="txtoken-error" modeule="/sub"
path="/doubleRegistError.jsp"/>
</action>
At the time of inheriting this function in the subclass, doExecute() method needs to be implemented
as the entry point.
For the settings of action mapping, refer to ActionMappingEx.
ActionMappingEx
Field Summary | |
---|---|
protected static java.lang.String |
FORWARD_TXTOKEN_ERROR
Logcial forward name when there is trasaction token check error. |
private static org.apache.commons.logging.Log |
log
Log class. |
private boolean |
saveToken
Check whether the transaction token is to be stored. Default is true(store). |
private boolean |
tokenCheck
Check whether to perform the transaction token check. Default is false(Do not check). |
Fields inherited from class org.apache.struts.action.Action |
---|
defaultLocale, servlet |
Constructor Summary | |
---|---|
ActionEx()
|
Method Summary | |
---|---|
protected void |
addErrors(javax.servlet.http.HttpSession session,
org.apache.struts.action.ActionMessages errors)
Fetches ActionMessages from the session by using Globals.ERROR_KEY, adds the ActionMessages and stores it again. |
protected void |
addMessages(javax.servlet.http.HttpSession session,
org.apache.struts.action.ActionMessages messages)
Fetches the ActionMessages from the session by using Globals.MESSAGE_KEY, adds the ActionMessages and stores it again. |
abstract org.apache.struts.action.ActionForward |
doExecute(org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionForm form,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Abstract method that executes the action. |
org.apache.struts.action.ActionForward |
execute(org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionForm form,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Executes the action. |
protected boolean |
isSaveToken()
Fetches the flag that stores transaction token. |
protected boolean |
isTokenCheck()
Fetches the flag that checks transaction token. |
protected boolean |
processTokenCheck(org.apache.struts.action.ActionMapping mapping,
javax.servlet.http.HttpServletRequest req)
Checks the transaction token. |
void |
setSaveToken(boolean saveToken)
Sets the flag which stores the transaction token. |
void |
setTokenCheck(boolean tokenCheck)
Sets the flag that checks transaction token. |
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
protected static final java.lang.String FORWARD_TXTOKEN_ERROR
private boolean tokenCheck
private boolean saveToken
Constructor Detail |
---|
public ActionEx()
Method Detail |
---|
public void setTokenCheck(boolean tokenCheck)
tokenCheck
- Transaction token check flagpublic void setSaveToken(boolean saveToken)
saveToken
- Transaction token storage flagprotected boolean isTokenCheck()
protected boolean isSaveToken()
public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.lang.Exception
Before calling doExecute() method implemented in subclass,
update the "modified" attribute of action form with "false".
After performing doExecute(), store the SKIP_POPULATE in the
"request" attribute if there is a change in the field value of action form.
processPopulate() is controlled by the RequestProcessorEx.
execute
in class org.apache.struts.action.Action
mapping
- Action mapping linked with this actionform
- Action formrequest
- Request informationresponse
- Response information
java.lang.Exception
- Exception at the time of executing actionpublic abstract org.apache.struts.action.ActionForward doExecute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.lang.Exception
Override this method in subclass and extend the functions of action.
mapping
- Action mapping linked with this actionform
- Action formrequest
- Request informationresponse
- Response information
java.lang.Exception
- Unexpected exception protected boolean processTokenCheck(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest req)
mapping
- Action mappingreq
- HTTP rquest
true
when the token is validprotected void addErrors(javax.servlet.http.HttpSession session, org.apache.struts.action.ActionMessages errors)
session
- Sessionerrors
- Error message informationprotected void addMessages(javax.servlet.http.HttpSession session, org.apache.struts.action.ActionMessages messages)
session
- Sessionmessages
- Message information
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |