This week's book giveaway is in the JDBC and Relational Databases forum.
We're giving away four copies of Murach's MySQL and have Joel Murach on-line!
See this thread for details.
Win a copy of Murach's MySQL this week in the JDBC and Relational Databases 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Information lost on error.

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have made a struts web project.

The problem I am having is when a user enters the values into the form and submits it.
If any one of the user inputted values are invalid, then I get the action to forwards back to
the input page. In doing so all the values that the user inputed in the form are lost.
Is there any way in which these values can be stored, apart from cookies.

Thanks
Achal Jalan
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Achal,

This shouldn't happen. Are you using the struts custom tags in your JSP? By this I mean <html:text> , <html:select>, <html:checkbox>, etc. If you use the struts tags along with a struts form bean, populating the fields is done for you when returning from a validation error. If you use the standard html tags, it is not.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having a similar problem i am using all struts only still getting it but only in html:select others like html:text are coming fine, is it something special with html:select, for more information on my error please read my full problem under heading html:select vanishing values just after this topic
Thanks
 
Achal Jalan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Merrill / Ardoks

I am using the struts tags and not HTML tags.

The code in my JSP is as follows



My assumption is it is because of the value I am setting for each of the fields, please let me know what I am doing wrong if this is the case or any other reason that you might think about.

P.S-> Everything is stored under the request scope.

Thanks
Achal Jalan
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In your action class, did you remember to place the form object in the request?

There should be a statement similar to this in your code prior to returning the forward object:
g
 
Ranch Hand
Posts: 502
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Umm..little rusty with struts. But won't setting the value attribute to blank cause a problem?



In your struts-config, what is the scope of the form-bean?

J
 
Achal Jalan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
setting the value caused the problem

it wrks fine now. Thanks a bunch guys
 
I am going down to the lab. Do NOT let anyone in. Not even this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic