Alex
Session.isNew() only help to a certain extent. I would check for existance
of objects that should exist in the Session.
eg
User user = session.getAttribute("user");
if (user == null) return mapping.findForward("logon");
Regards
Michael Mok
-----Original Message-----
From: Alex Colic [mailto:[EMAIL PROTECTED]]
Sent: Saturday, 8 December 2001 9:31
To: Struts
Subject: RE: Can't forward to a global-Here's the code in question?
Here the action class, slightly abbreviated.
package com.popware.rd.viPro.action;
public class viInvoiceSummaryAction extends Action
{
private static final Category
cat=Category.getInstance(viInvoiceSummaryAction.class.getName());
private HttpSession session;
private ActionErrors errors=new ActionErrors();
private ActionMessages messages=new ActionMessages();
public ActionForward perform( ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws java.io.IOException,
javax.servlet.ServletException
{
errors.clear();
messages.clear();
session=request.getSession();
if(session == null || session.isNew()) return
(mapping.findForward("logon"));
Vector v=new Vector();
v=getInvoiceSummary();
if(messages.empty())
{
if((v.size()>0) && (v!=null))
{
request.setAttribute("invoiceSummary",v);
}
}
if(!errors.empty())
{
this.saveErrors(request,errors);
return (new ActionForward(mapping.getInput()));
}
if(mapping.getAttribute()!=null)
if("request".equals(mapping.getScope()))
{
request.removeAttribute(mapping.getAttribute());
}
return (mapping.findForward("success"));
}
}
I can see the logon page loading and then the rest of this classes code gets
executed.
Thanks for any help.
Alex
-----Original Message-----
From: Tom Klaasen (TeleRelay) [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 07, 2001 4:30 AM
To: Struts Users Mailing List
Subject: RE: Can't forward to a global?
> -----Original Message-----
> From: Alex Colic [mailto:[EMAIL PROTECTED]]
> Sent: donderdag 6 december 2001 22:06
> To: Struts
> Subject: Can't forward to a global?
>
>
>
> Hi,
>
> I have an action class that could get called after a users session has
> expired. When the action class is called I have the following code:
>
> if(session == null || session.isNew())
> {
> return mapping.findForward("logon");
> }
> I have a global forward defined for "logon."
>
> Now the problem:
>
> When a user's session is expired and the click a link they go to this
> action. The if statement evaluates to true and the forward to "logon"
> correctly occurs. Then the rest of the Action code continues to be
> evaluated.
>
> Why is the rest of my code following the above if statement
> continuing to be
> run when I have done a forward?
Are you absolutely sure about this? No other people on your server who
could generate the same debug code as you? Because I don't expect the
code to continue: the return ...; statement jumps out of the method.
hth,
tomK
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>