This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Cookies and Struts

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Nothing? Or something? Like this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic