struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <newton.d...@yahoo.com>
Subject Re: Strange behavior: Trying to implement saveToken() in display actions.
Date Wed, 02 Apr 2008 16:22:53 GMT
--- Martin Gainty <mgainty@hotmail.com> wrote:
> 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());

I guess I'm not sure what that has to do with an S1 token issue; could you
explain further?

Dave

> ----- Original Message -----
> From: "Doug Lochart" <dlochart@gmail.com>
> 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 <dlochart@gmail.com> 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 capesafe.web.action.DisplayCreateAccountAction@2f729e
> > >  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
> 
=== message truncated ===


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message