• 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

reload request level lists after validation

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using Struts 2, and I have a number of fields on which I perform some basic validation. Upon submission everything goes to the MyClass-validations.xml and the fields fail/pass. When they pass everything is rosey, but when they fail I get exceptions. The root of this is that I have a list that is retrieved by another action on page load. What I need to know is - is there a way to get hang on to this request level list for reuse if validation fails? Thanks in advance.
 
Fletcher Munson
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've resolved this by using the validate method.



pretty simple
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
FWIW, you could just have a getter in the action that returns the list and skip putting it in the request altogether.

That has the side benefit of taking non-validation stuff out of the validate() method.
 
Fletcher Munson
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm entering transactions for an accounting system, and I need to retrieve the list based on the type of transaction. I use an initial action on page load to determine what the list will contain. I need to perform the same assessment during validation. If I just use a getter I didn't think the jsp would know about the type when it renders the page. Or am I wrong?

This brings me to my next question which I think should be a new topic.

Please take a look:

https://coderanch.com/t/428245/Struts/Using-multiple-JSPs-one-Action
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic