• 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

No validation before LookupDispatchAction

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm creating some kind of wizard with struts. On most of the pages, there should be a Back and a Next button. I'm using LookupDispatchAction classes to acheive that.

Obviously when somebody clicks the back button, the previous page should be shown. Validation of the current form is therefore not nessecary. The problem is that the form bean is being validated (nessecary when the next button is clicked). Is there some kind of way I can disable the validation when the back button is clicked?
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can set validate="false" in the struts-config and do a explicit call to the validate method of the form based on the required criteria.
 
Tim Storms
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I tried that, but if I'm not mistaken, I have to change form automatic xml validation to manual validation in the validate method of my form bean?! Correct me if I'm wrong. Is there a way to be able to keep on using automatic validation? I'm having a lot of forms (40+) so changing the validation type would be a lot of work.
 
Dileep Kamath
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A call to validate method of the ValidatorForm would invoke the validations defined in the xmls, so you wouldn't need to do anything specific to a form to invoke the validations.
 
Tim Storms
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok nice, it works.

In my LookupDispatchAction class, I've written the following code (I left a piece out):

Is there even an easier way to do this, or does this piece of code seems to be fine?

Also, the saveErrors method is deprecated. Can I use another method or do I have to live with it?

Thx...
 
Dileep Kamath
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yup, thats the way it works...

Struts 1.2 has introduced

to replace


ActionErrors extends ActionMessages so you should be ok. If you want to remove any warnings then just typecast errors to ActionMessages
 
Tim Storms
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your information! I was able to implement it successfully.
 
There’s no place like 127.0.0.1. But I'll always remember this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic