This week's giveaway is in the Testing forum.
We're giving away four copies of TDD for a Shopping Website LiveProject and have Steven Solomon on-line!
See this thread for details.
Win a copy of TDD for a Shopping Website LiveProject this week in the Testing 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

How to validate boolean with XML using Expression in Struts2

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I have boolean field in action
testMeAction.class
private boolean testMe with stter and getter.

testMeAction-validation.xml

<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">

<validators>

<validator type="expression" short-circuit="true">
<param name="expression"><![CDATA[(testMe == false) && myGroup == null]]></param>
<message key="user.message" />
</validator>

</validators>

I would like to validate and display message when testMe and myGroup
But for some reason, it allways diplaying message, what ever value of testMe is.

Please can someone advice, where I am going wrong.

Thanks
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ish Fad wrote:
testMeAction.class
private boolean testMe with stter and getter.



Do you have getters/setters for myGroup?


Ish Fad wrote:
I would like to validate and display message when testMe and myGroup



When testMe and myGroup are what?

Ish Fad wrote:
But for some reason, it allways diplaying message, what ever value of testMe is.



What is the value for myGroup?
 
Now I am super curious what sports would be like if we allowed drugs and tiny ads.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic