I go directly to the welcome page this way:

struts-config:

<action path="/Logoff"
    type="com.childrencare.LogoffAction">
    <forward
    name="success"
    path="/index.jsp"/>
    </action>  

In action:
public final class LogoffAction extends Action {

public ActionForward execute(ActionMapping mapping,

ActionForm form,

HttpServletRequest request,

HttpServletResponse response)

throws IOException, ServletException {

// Extract attributes we will need

HttpSession session = request.getSession();



String user = (String)

session.getAttribute(Constants.USER_KEY);

// Remove user login

session.removeAttribute(Constants.USER_KEY);

// Return success

return (mapping.findForward(Constants.SUCCESS));

Barry









----- Original Message ----- 
From: "Caroline Jen" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, October 28, 2003 6:02 PM
Subject: RE: Forward Cannot Be Achieved In One Step


> I have tried your suggestion.  It still takes two
> steps to go back to the welcome page.  
> 
> As long as there are two actions in between, it does
> not seem that I can go directly from "clicking the
> LOGOUT buttion" to "have the welcome page displayed".
> 
> I really wish to learn what people usually do - the
> first one of those two actions is Logoff.java in which
> I invalidate the session, ..., etc. and the second
> action upon success will lead the user to the welcome
> page in which choices available for unregistered
> members plus a LOGON buttion are provided.
> 
> -Caroline
> 
> --- Yansheng Lin <[EMAIL PROTECTED]> wrote:
> > At the end of your first action execute() method, do
> > 
> > a redirect to the second action. Something like the 
> > following:
> > return new ActionForward("secondAction.do");
> > 
> > Hope this helps!
> > 
> > -Yan
> > 
> > -----Original Message-----
> > From: Caroline Jen [mailto:[EMAIL PROTECTED] 
> > Sent: October 28, 2003 2:51 PM
> > To: Struts Users Mailing List
> > Subject: RE: Forward Cannot Be Achieved In One Step
> > 
> > 
> > Let me re-phrase my question.
> > 
> > Upon the user click on the LOGOUT buttion, I have
> > two
> > actions - the first one of the actions is
> > Logoff.java
> > in which I invalidate the session, ..., etc. and the
> > second action upon success will lead the user to the
> > welcome page in which choices for unregistered
> > member
> > plus a LOGON buttion is provided.
> >  
> > As long as two actions are involved, the user does
> > not
> > get back to the welcome page by just click on the
> > LOGOFF button "only once". 
> > 
> > Need your guidance on how such a situation is
> > usually
> > handled? 
> > 
> > 
> > --- Caroline Jen <[EMAIL PROTECTED]> wrote:
> > > Thanks for the reply.  Now, I understand that I
> > have
> > > two actions.  However, I do quite understand what
> > > you
> > > suggested.  You said:
> > > 
> > > u can also use 
> > > <html:link action="/Logoff">logoff</html:link>
> > > where logoff is ur global forward.
> > > <html:link forward="/Logoff">logoff</html:link>
> > > 
> > > I still have two actions if I use 
> > > <html:link action="/do/Logoff">logoff</html:link>
> > > 
> > > because I have
> > > 
> > > <action 
> > >    path="/Logoff"
> > >   
> > >
> > type="org.NameOfOrganization.signoff.LogoffAction">
> > >      <forward
> > >         name="success"
> > >         path="/do/Menu"/>
> > > </action>
> > >  
> > > In the LogoffAction.java, I invalidate the session
> > > and I want the user to go back the welcome page. 
> > > And
> > > 
> > > <action
> > >   path="/Menu"
> > >   name="menuForm"
> > >
> >
> type="org.apache.struts.scaffold.ExistsAttributeAction"
> > >   parameter="application;HOURS">
> > >      <forward
> > >         name="success"
> > >         path=".article.Menu"/>
> > >      <forward
> > >         name="failure"
> > >         path="/do/MenuCreate"/>
> > >  
> > > The .article.Menu is my tile that displays the
> > > welcome
> > > page.
> > > 
> > > 
> > > 
> > > --- [EMAIL PROTECTED] wrote:
> > > > u can also use 
> > > > <html:link action="/Logoff">logoff</html:link>
> > > > where logoff is ur global forward.
> > > > <html:link forward="/Logoff">logoff</html:link>
> > > > hence it wont be a 2 step stuff but directly
> > > calling
> > > > ur Action class which does cleanup work for the
> > > log
> > > > off process as session cleaning up and
> > > invalidating
> > > > the other objects (probably signing off the
> > user),
> > > > And forwards later on to one of the jsp's 
> > > > U can create a global forward for the same too
> > > which
> > > > represents an action.
> > > > I guess its only available in 1.1 version of
> > > Struts.
> > > > 
> > > > 
> > > > -----Original Message-----
> > > > From: Caroline Jen [mailto:[EMAIL PROTECTED]
> > > > Sent: 28 October 2003 17:05
> > > > To: Struts Users Mailing List
> > > > Subject: Re: Forward Cannot Be Achieved In One
> > > Step
> > > > 
> > > > 
> > > > The do/Menu "does" display my welcome page.  The
> > > > LOGOUT button and forward "does" eventually lead
> > > the
> > > > visitor to the welcome page.  The problem is
> > that
> > > it
> > > > takes two steps intead of going straight to the
> > > > welcome page.  Let me re-state my problem:
> > > > 
> > > > I have the following code in the navbarMenu.jsp:
> > > > 
> > > > <html:link forward="exit">LOGOUT</html:link>
> > > > 
> > > > and in the struts-config.xml, I have:
> > > > 
> > > > <forward
> > > >    name="exit"
> > > >    path="/do/Logoff"/>
> > > > 
> > > > and 
> > > > 
> > > > <action 
> > > >    path="/Logoff"
> > > >   
> > > >
> > >
> > type="org.NameOfOrganization.signoff.LogoffAction">
> > > >      <forward
> > > >          name="success"
> > > >          path="/do/Menu"/>
> > > > </action>
> > > > 
> > > > In the LogoffAction.java, I invalidate the
> > session
> > > > and
> > > > I want the user to go back the welcome page. 
> > And 
> > > > 
> > > > <action
> > > >   path="/Menu"
> > > >   name="menuForm"
> > > > 
> > > >
> > >
> >
> type="org.apache.struts.scaffold.ExistsAttributeAction"
> > > >   parameter="application;HOURS">
> > > >     <forward
> > > >        name="success"
> > > >        path=".article.Menu"/>
> > > >     <forward
> > > >        name="failure"
> > > >        path="/do/MenuCreate"/>
> > > > 
> > > > The .article.Menu is my tile that displays the
> > > > welcome
> > > > page.
> > > > 
> > > > The problem is that it takes two steps for the
> > > user
> > > > to
> > > > go back to the welcome page - After the first
> > > click,
> > > > the same screen remains in the browser.  The
> > only
> > > > change is what is shown in the address bar.  I
> > > have
> > > > to
> > > > click the LOGOFF button "again" and then the
> > > welcome
> > > > page is displayed.  
> > > > 
> > > > What should I do to go back to the welcome page
> > in
> > > > one
> > > > step?
> > > > 
> > > > --- "Ruth, Brice" <[EMAIL PROTECTED]> wrote:
> > > > > Is your "Menu" actionforward the welcome
> > screen
> > > > you
> > > > > want to get to? And 
> > > > > does your Action return an ActionForward to
> > > this?
> > 
> === message truncated ===
> 
> 
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to