• 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

Validation being ignored

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I'm having some trouble getting my struts 2 validation to work properly let alone getting fielderror tags displayed.

The action mapping:



The action class itself:



jsp snippet:



An interesting part of the log file (full log is attached):



He runs the validators but still executes the query part of the execute method.
He doesn't return to the input page because afterwards the url is like this: .../search/searchByPrice.action?minPrice=&maxPrice=&resultCount=10

Any help would be appreciated!
Arne
 
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
My first guess would be that it's because you're using primitive doubles. The default value of a primitive double is 0, and you're using the "required" validator, so there's no reason for the framework to think they don't exist.

If you want to use the "required" validator I think you'd need to use the object version, Double.
 
Gino Verhulst
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yep that worked. I'm having a "I-can't-believe-I-couldn't-come-up-with-that-myself" moment.
Anyway, thanks a lot!
 
David Newton
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
If we had a nickel for every time we had moments like that we'd be rich! ;)
 
I'd appreciate it if you pronounced my name correctly. Pinhead, with a silent "H". Petite ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic