File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes cookies in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "cookies in struts" Watch "cookies in struts" New topic

cookies in struts

Bhaskar Reddy
Ranch Hand

Joined: Dec 17, 2002
Posts: 52

In my index.jsp, there are 3 fields - username text, password text & 'remember me' checkbox. When the user has entered username & password and selected 'remember me' checkbox, I need to authenticate the username/password combination & put the username in browser's cookie.

I am able to authenticate as well as set up the cookie, but my problem is on the displaying part. Here is the code -

Interestingly, both <logic:notPresent> & <logic : present> works when the cookie is set; and both <logic:notPresent> & <logic resent> fail when cookie is removed from the browser. One would think that one of them should work when cookie is available (or removed).

It would be great if anyone can point out where my mistake is!

Thanks in Adv...
[ June 20, 2007: Message edited by: Bhaskar Reddy ]
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
Nothing jumps out at me. I have never used the cookie attribute of the logic:present tag. Have you tried removing the scope attribute?

- Brent
Bhaskar Reddy
Ranch Hand

Joined: Dec 17, 2002
Posts: 52
I did try removing the scope attribute...

I want to use JSTL version of these tags but couldn't really succeed with them... If anyone knows the JSTL version of using the cookie in JSP, pls let me know!
subject: cookies in struts
It's not a secret anymore!