History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: WW-1380
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: tm_jee
Reporter: tm_jee
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
WebWork

Validator defined in xml should be able to parse xml tag values against value stack

Created: 20/Nov/06 07:23 AM   Updated: 25/Nov/06 01:07 AM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.2.5


 Description  « Hide
Validator defined in xml should be able to parse xml tag values against value stack

see http://forums.opensymphony.com/post!reply.jspa?messageID=102420 for more info

 All   Comments   Change History      Sort Order:
tm_jee - [24/Nov/06 11:51 PM ]

tm_jee - [25/Nov/06 01:05 AM ]
Hi guys,

added
    protected Object conditionalParse(String expression) {
     if (parse) {
     OgnlValueStack stack = ActionContext.getContext().getValueStack();
     return TextParseUtil.translateVariables('$', expression, stack);
     }
     return expression;
    }

to ValidatorSupport such that custom validator that extends off this, which have String params that would like to take advantages of value stack parsing could do so. eg.

public class MyValidator extends ValidatorSupport {
    private String someInteger;
    // getter/setter ommited

public void validate(Object object) throws ValidationException {
         // one possibility would be
         Integer _int = conditionalParse(someInteger);
         ....
    }
}

<validators>
   <field ...>
      <field-validator type="myCustomValidator">
           <param name="someInteger">${#someIntegerFromValueStackContext}</param>
      </field-validator>
   </field>
</validators>