This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Cookies and Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Cookies and Struts" Watch "Cookies and Struts" New topic

Cookies and Struts

Achal Jalan

Joined: Nov 23, 2004
Posts: 21

My application starts of with an index.jsp page where the user inputs his name and email address, this call an action 'createCookie' where the details are stored in a cookie.

I need the details to be read from the cookie and displayed to the user the next time he opens the webpage.

The relevant code int index.jsp

The revelant code in

The code in bold italics in index.jsp in the text input box is where I am getting the error. If any one could point me the right way to do this, it will be great.

The error I get is "attribute nameCookie has no value", even though the line above that prints out the value of the nameCookie.

Thanks a bunch
[ February 28, 2005: Message edited by: Achal Jalan ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
In the JSP Code, simply remove the "value" attribute. In a Struts <html:text> tag, the value comes from the property attribute, and the value attribute generally does not need to be specified.


Consultant, Sima Solutions
Bhaskar Reddy
Ranch Hand

Joined: Dec 17, 2002
Posts: 52

In the above scenario, if we want to display the cookie value in a text-box (instead of read-only label), how do we display the same?

The below code doesnt display it in the text-box, even though until the previous line, the cookie value is coming... can someone point out my mistake?

I think Merrill said something about
...the value comes from the property attribute..

Does that mean the cookie name & the text-box name must be same??

My jsp code is -

Thank you,
I agree. Here's the link:
subject: Cookies and Struts
Similar Threads
struts -- Cannot find bean under name indexedWorkInProgressVO
When to use logic:present tag
Iterate Hashmap of object
cookies in struts
No getter method for property username of bean User