aspose file tools*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Cookies and Struts" Watch "Cookies and Struts" New topic
Author

Cookies and Struts

Achal Jalan
Greenhorn

Joined: Nov 23, 2004
Posts: 21
Hi

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 createCookie.java





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
Achal
[ 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.

Merrill


Merrill
Consultant, Sima Solutions
Bhaskar Reddy
Ranch Hand

Joined: Dec 17, 2002
Posts: 52
Hi,

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,
Bhaskar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cookies and Struts
 
Similar Threads
Iterate Hashmap of object
No getter method for property username of bean User
struts -- Cannot find bean under name indexedWorkInProgressVO
When to use logic:present tag
cookies in struts