Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Struts2:Conditional visitor validator not conditional  RSS feed

Kev Adams
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having a little trouble with the "conditionalvisitor" validator in Struts2. The "conditionalvisitor" validator is supposed to redirect the validation to the model, based on a condition. In my case, it is performing both sets of validation. This is causing false validation errors in my form.

My form has two radio buttons like so:

The "enableSingle()" and "enableMultiple()" call javascript functions to enable the fields of the radio button that is currently selected and disable the fields of the button that is not selected.

I'm using the ModelDriven approach and I have a single CRUD action (a la the Struts 2 In Action book). Inside that action, I have a "save" method, and my action alias looks like "CrudAction-save-validation.xml"

Here is the snippet from my CrudAction-save-validation.xml.

Normally, I'd never use the "==" to compare two strings, but this is how it is described on the Struts2 site here

I'm running this on a Websphere 6.1 server.

Has anyone encountered this before, and if so, what did you do? Unfortunately, there's not a lot of information about the "conditionalvisitor" validator from Google searches.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!