• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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?
 
if you think brussel sprouts are yummy, you should try any other food. And this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic