• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

The old mutliple pages submit to one action problem...

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,
This is one of those common questions that I just forget the answer to.
If you use the INPUT tag in an action mapping, you give struts a JSP page or another action to return control to when form validation errors are found.
Now what do you do when you have a couple different JSP pages, or forms I geuss, that can submit to the same action mapping?
Is this just one of those things you shouldn't do? Like we all should be using tiles or something so that our page links are generic?
 
Sheriff
Posts: 17665
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are these unrelated pages or are they related, as in a wizard? In Struts 1.1 an Exception will be thrown if you try to change the input of a mapping once it has been configured. Prior to 1.1 you could change it programmatically via setInput().
I don't know if there's another approach but my workaround is to bypass the call to validate() at the framework level by setting validate=false in struts config, then invoke the form's validate() in the Action's execute() method. If I get errors back, save them and since I know which page I'm currently on, just forward to that page.
 
Paul Duer
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Junliu,
You kinda hit the nail on the head. In my example, or at least what I am thinking about, is you have two totaly unrelated business pages. Meaning that while the relate to the same data interaction, they are entered for different reasons.
A good example is a "pipeline" page, I have one for open and one for closed. They access the same data, but they present a different dataset with different columns and needs.
So I usally use a single action to recieve requests, usally basic stuff that is done on either page. So this is where you get into the issue.
I guess it seems like the rule is, if you have more than one page using the same action, you can't validate much at the form level, but in the action you can do whatever you want.
 
The knights of nee want a shrubbery. And a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic