Doug- Is there any reason (other than political) why you are using 1.3.8 instead of 2.0.11+ if your concerned about implement singleton servlet context then implement your own FilterDispatcher e.g.
public class MyFilterDispatcher extends FilterDispatcher { public void setFilterConfig(FilterConfig filterConfig) { //so you can achieve this objective using ServletContextSingleton class ServletContextSingleton singleton = ServletContextSingleton.getInstance(); singleton.setServletContext(filterConfig.getServletContext()); ? Martin ----- Original Message ----- From: "Doug Lochart" <[EMAIL PROTECTED]> To: <user@struts.apache.org> Sent: Wednesday, April 02, 2008 6:43 AM Subject: Re: Strange behavior: Trying to implement saveToken() in display actions. > I am just learning Struts. I think I may have forgotten some > information that you might need in order to provide any help. I am > using Struts 1.3.8, JDK 1.6, running on Tomcat 5.5. > > If my problem is SO SIMPLE and hence why I have heard silence then I > am sorry but this is my first app and I so far what I have done looks > like it should work. > > Does anyone have any ideas? > > regards, > > Doug Lochart > > On Tue, Apr 1, 2008 at 2:02 PM, Doug Lochart <[EMAIL PROTECTED]> wrote: > > I am trying to implement a pattern so that I can use struts tokens to > > help prevent double submission. I seem to be getting a strange > > sequence of events that I don't quite follow. Here is what I want to > > do at a high level > > > > displayCreateAccount -- forwards to --> CreateAccount.jsp (with form > > action defined as /createAccount) > > createAccount -- forwards to --> displayCreateAccountStep2 -- forwards > > to --> CreateAccountStep2.jsp > > > > The actions that start with 'display' merely set the struts token (e.g > > saveToken( request ); ) > > Then it forwards it along to a jsp. > > > > The actions that start with 'Create' check to see if the token is > > valid then it processes the form submission and then > > forwards it to another display action which will then set the next > > toke for the next display of a JSP. > > > > I have checked and rechecked all of my configs but I do not see a > > mistake. I have also rebuilt the entire war > > and cleaned out EVERYTHING in Tomcat but I get the same result. When > > I hit the first displayCreateAccount action > > it properly forwards control to the jsp page that is then presented. > > When the form on the jsp page is submitted > > the displayCreateAccountStep2 action is found (see log below) in the > > mapping YET the original displayCreateAccount is executed. I have > > turned on > > debug of org.apache.struts. Here is my struts-config.xml and a > > snippet of the logs showing what is happening. > > > > I am curious as to why this is happening. I really want to understand > > what I am doing wrong or why it is working this way. > > Please let me know if I need to supply any more supporting documents. > > > > thanks > > > > Doug > > > > snippet from struts-config.xml > > > > ------------ > > > > <global-forwards> > > <forward name="logon" path="/logon.do"/> > > <forward name="logoff" path="/logoff.do"/> > > <forward name="doubleSubmit" path="display.double.submit"/> > > </global-forwards> > > > > <action-mappings> > > > > <action path="/displayCreateAccount" > > type="capesafe.web.action.DisplayCreateAccountAction" > > name="accountSetupForm" > > scope="request" > > cancellable="true" > > validate="false"> > > <forward name="display1" path="display.create.account.1"/> > > </action> > > > > <action path="/createAccount" > > type="capesafe.web.action.CreateAccountAction" > > name="accountSetupForm" > > scope="request" > > cancellable="true" > > input="display.create.account.1"> > > <forward name="success" path="/displayCreateAccountStep2"/> > > <forward name="failure" path="/WEB-INF/common/FailedLogon.jsp"/> > > <forward name="cancel" path="/WEB-INF/common/CancelLogon.jsp"/> > > </action> > > > > <action path="/displayCreateAccountStep2" > > type="capesafe.web.action.DisplayCreateAccountActionStep2" > > name="accountSetupForm" > > scope="request" > > cancellable="true" > > validate="false"> > > <forward name="displayStep2" path="display.create.account.2"/> > > </action> > > > > <action path="/createAccountStep2" > > type="capesafe.web.action.CreateAccountActionStep2" > > name="accountSetupFormStep2" > > scope="request" > > cancellable="true" > > input="display.create.account.2"> > > <forward name="success" path="display.create.account.3"/> > > <forward name="failure" path="/WEB-INF/common/FailedLogon.jsp"/> > > <forward name="cancel" path="/WEB-INF/common/CancelLogon.jsp"/> > > </action> > > </action-mappings> > > > > ----------------- > > snippet from log > > ------------------ > > > > 42274 2008-04-01 13:38:12,979 DEBUG ModuleUtils - Get module name for > > path /displayCreateAccount.do > > 42274 2008-04-01 13:38:12,979 DEBUG ModuleUtils - Module name found: default > > 42274 2008-04-01 13:38:12,979 INFO ComposableRequestProcessor - > > Initializing composable request processor for module prefix '' > > 42274 2008-04-01 13:38:12,979 DEBUG ComposableRequestProcessor - > > setActionContextClassName: no className specified > > 42296 2008-04-01 13:38:13,001 DEBUG ComposableRequestProcessor - > > Using processing chain for this request > > 42296 2008-04-01 13:38:13,001 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.ExceptionCatcher > > 42296 2008-04-01 13:38:13,001 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.SelectLocale > > 42296 2008-04-01 13:38:13,001 DEBUG AbstractSelectLocale - retrieve config... > > 42298 2008-04-01 13:38:13,003 DEBUG AbstractSelectLocale - set > > context locale to en_US > > 42299 2008-04-01 13:38:13,004 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.SetOriginalURI > > 42299 2008-04-01 13:38:13,004 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.RequestNoCache > > 42299 2008-04-01 13:38:13,004 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.SetContentType > > 42299 2008-04-01 13:38:13,004 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.RemoveCachedMessages > > 42300 2008-04-01 13:38:13,005 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.SelectAction > > 42300 2008-04-01 13:38:13,005 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.AuthorizeAction > > 42300 2008-04-01 13:38:13,005 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.CreateActionForm > > 42300 2008-04-01 13:38:13,005 DEBUG CreateActionForm - Look up > > form-bean accountSetupForm > > 42303 2008-04-01 13:38:13,008 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.PopulateActionForm > > 42304 2008-04-01 13:38:13,009 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.ValidateActionForm > > 42304 2008-04-01 13:38:13,009 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.SelectInput > > 42304 2008-04-01 13:38:13,009 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.ExecuteCommand > > 42305 2008-04-01 13:38:13,010 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.SelectForward > > 42305 2008-04-01 13:38:13,010 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.SelectInclude > > 42305 2008-04-01 13:38:13,010 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.PerformInclude > > 42305 2008-04-01 13:38:13,010 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.CreateAction > > 42306 2008-04-01 13:38:13,011 INFO CreateAction - Initialize action > > of type: capesafe.web.action.DisplayCreateAccountAction > > 42309 2008-04-01 13:38:13,014 DEBUG AbstractCreateAction - setting > > action to [EMAIL PROTECTED] > > 42309 2008-04-01 13:38:13,014 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.ExecuteAction > > 42309 2008-04-01 13:38:13,014 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.ExecuteForwardCommand > > 42310 2008-04-01 13:38:13,015 DEBUG I18nFactorySet - Can't open file > > '/WEB-INF/tiles-defs_en_US.xml' > > 42314 2008-04-01 13:38:13,019 DEBUG I18nFactorySet - Can't open file > > '/WEB-INF/tiles-defs_en.xml' > > 42316 2008-04-01 13:38:13,021 INFO TilesPreProcessor - Tiles process > > complete; forward to /WEB-INF/tiles/layout.jsp > > 42359 2008-04-01 13:38:13,064 DEBUG InsertTag - insert > > page='/WEB-INF/tiles/header.jsp'. > > 42518 2008-04-01 13:38:13,223 DEBUG InsertTag - insert > > page='/WEB-INF/tiles/menu.jsp'. > > 42540 2008-04-01 13:38:13,245 DEBUG InsertTag - insert > > page='/WEB-INF/common/CreateAccount.jsp'. > > 42748 2008-04-01 13:38:13,453 DEBUG InsertTag - insert > > page='/WEB-INF/tiles/footer.jsp'. > > 42902 2008-04-01 13:38:13,607 DEBUG TilesPreProcessor - Tiles > > processed, so clearing forward config from context. > > 42902 2008-04-01 13:38:13,607 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.PerformForward > > > > < -- what follows is after I submit the form, this is where it gets odd --> > > > > 60247 2008-04-01 13:38:30,952 DEBUG ModuleUtils - Get module name for > > path /createAccount.do > > 60247 2008-04-01 13:38:30,952 DEBUG ModuleUtils - Module name found: default > > 60247 2008-04-01 13:38:30,952 DEBUG ComposableRequestProcessor - > > Using processing chain for this request > > 60247 2008-04-01 13:38:30,952 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.ExceptionCatcher > > 60247 2008-04-01 13:38:30,952 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.SelectLocale > > 60247 2008-04-01 13:38:30,952 DEBUG AbstractSelectLocale - retrieve config... > > 60248 2008-04-01 13:38:30,953 DEBUG AbstractSelectLocale - set > > context locale to en_US > > 60248 2008-04-01 13:38:30,953 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.SetOriginalURI > > 60248 2008-04-01 13:38:30,953 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.RequestNoCache > > 60248 2008-04-01 13:38:30,953 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.SetContentType > > 60248 2008-04-01 13:38:30,953 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.RemoveCachedMessages > > 60248 2008-04-01 13:38:30,953 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.SelectAction > > 60248 2008-04-01 13:38:30,953 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.AuthorizeAction > > 60248 2008-04-01 13:38:30,953 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.CreateActionForm > > 60248 2008-04-01 13:38:30,953 DEBUG CreateActionForm - Look up > > form-bean accountSetupForm > > 60248 2008-04-01 13:38:30,953 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.PopulateActionForm > > 60249 2008-04-01 13:38:30,954 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.ValidateActionForm > > 60308 2008-04-01 13:38:31,013 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.SelectInput > > 60308 2008-04-01 13:38:31,013 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.ExecuteCommand > > 60308 2008-04-01 13:38:31,013 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.SelectForward > > 60308 2008-04-01 13:38:31,013 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.SelectInclude > > 60308 2008-04-01 13:38:31,013 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.PerformInclude > > 60308 2008-04-01 13:38:31,013 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.CreateAction > > 60308 2008-04-01 13:38:31,013 INFO CreateAction - Initialize action > > of type: capesafe.web.action.CreateAccountAction > > 60310 2008-04-01 13:38:31,015 DEBUG AbstractCreateAction - setting > > action to [EMAIL PROTECTED] > > 60310 2008-04-01 13:38:31,015 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.ExecuteAction > > 60311 2008-04-01 13:38:31,016 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.ExecuteForwardCommand > > 60311 2008-04-01 13:38:31,016 DEBUG TilesPreProcessor - no uri > > computed, so pass to next command > > > > <!-- look at this ... it sees the displayCreateAccountStep action but > > it executes displayCreateAccount.do instead ???--> > > 60311 2008-04-01 13:38:31,016 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.PerformForward > > 60312 2008-04-01 13:38:31,017 DEBUG PerformForward - Forwarding to > > /displayCreateAccountStep2 > > 60312 2008-04-01 13:38:31,017 DEBUG ModuleUtils - Get module name for > > path /displayCreateAccount.do > > 60312 2008-04-01 13:38:31,017 DEBUG ModuleUtils - Module name found: default > > 60312 2008-04-01 13:38:31,017 DEBUG ComposableRequestProcessor - > > Using processing chain for this request > > 60312 2008-04-01 13:38:31,017 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.ExceptionCatcher > > 60312 2008-04-01 13:38:31,017 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.SelectLocale > > 60312 2008-04-01 13:38:31,017 DEBUG AbstractSelectLocale - retrieve config... > > 60312 2008-04-01 13:38:31,017 DEBUG AbstractSelectLocale - set > > context locale to en_US > > 60313 2008-04-01 13:38:31,018 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.SetOriginalURI > > 60313 2008-04-01 13:38:31,018 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.RequestNoCache > > 60313 2008-04-01 13:38:31,018 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.SetContentType > > 60313 2008-04-01 13:38:31,018 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.RemoveCachedMessages > > 60313 2008-04-01 13:38:31,018 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.SelectAction > > 60313 2008-04-01 13:38:31,018 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.AuthorizeAction > > 60313 2008-04-01 13:38:31,018 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.CreateActionForm > > 60313 2008-04-01 13:38:31,018 DEBUG CreateActionForm - Look up > > form-bean accountSetupForm > > 60313 2008-04-01 13:38:31,018 DEBUG FormBeanConfig - Can reuse > > existing instance (non-dynamic) > > 60313 2008-04-01 13:38:31,018 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.PopulateActionForm > > 60313 2008-04-01 13:38:31,018 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.ValidateActionForm > > 60313 2008-04-01 13:38:31,018 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.SelectInput > > 60313 2008-04-01 13:38:31,018 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.ExecuteCommand > > 60313 2008-04-01 13:38:31,018 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.SelectForward > > 60313 2008-04-01 13:38:31,018 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.SelectInclude > > 60313 2008-04-01 13:38:31,018 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.PerformInclude > > 60313 2008-04-01 13:38:31,018 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.CreateAction > > 60313 2008-04-01 13:38:31,018 DEBUG AbstractCreateAction - setting > > action to [EMAIL PROTECTED] > > 60313 2008-04-01 13:38:31,018 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.ExecuteAction > > 60314 2008-04-01 13:38:31,019 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.ExecuteForwardCommand > > 60314 2008-04-01 13:38:31,019 INFO TilesPreProcessor - Tiles process > > complete; forward to /WEB-INF/tiles/layout.jsp > > 60314 2008-04-01 13:38:31,019 DEBUG InsertTag - insert > > page='/WEB-INF/tiles/header.jsp'. > > 60483 2008-04-01 13:38:31,188 DEBUG InsertTag - insert > > page='/WEB-INF/tiles/menu.jsp'. > > 60494 2008-04-01 13:38:31,199 DEBUG InsertTag - insert > > page='/WEB-INF/common/CreateAccount.jsp'. > > 60524 2008-04-01 13:38:31,229 DEBUG InsertTag - insert > > page='/WEB-INF/tiles/footer.jsp'. > > 60566 2008-04-01 13:38:31,271 DEBUG TilesPreProcessor - Tiles > > processed, so clearing forward config from context. > > 60566 2008-04-01 13:38:31,271 DEBUG ActionCommandBase - Executing > > org.apache.struts.chain.commands.servlet.PerformForward > > > > -- > > What profits a man if he gains the whole world yet loses his soul? > > > > > > -- > What profits a man if he gains the whole world yet loses his soul? > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]