Addendum:

Currently I have the followign in my JSP
<bean:cookie id="validUser" name="userCookie">
<logic:notpresent name="person">  
<bean:write name="userCookie"/> 
        <jsp:forward page="/pages/error.jsp" />
</logic:present>  

and this in my Action class
String cookieValue = new java.util.Date().toString();
Cookie c = new Cookie ("validUser", cookieValue);//FIXME make more useful
c.setMaxAge(3600*24); //FIXME make a parameter later
response.addCookie(c);

---------- Forwarded message ----------
From: Dave Johnson <[EMAIL PROTECTED]>
Date: Tue, 21 Sep 2004 08:41:47 -0400
Subject: Checking a cookie or redirecting - best way?
To: Struts Users Mailing List <[EMAIL PROTECTED]>

hi all

Well now I've got this cookie that I need to check for, and if it
exists, lovely. Nothing else needs to be done.

if NOT, I need to send the user to a specific page (/error.jsp).

I was thinking of using <logic:present> to check for the bean, but I
dont want to wrap all my jsp code with that tag, what I really want is
something simple at the beginning that checks if the bean is there
then does a redirect if there's an error.

should I be using a struts tag or scriptlet?

what about if I need to include something like that in HTML (using
javascript) has anyone done that?

Thanks

D

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to