Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.2.1
-
None
-
Webworks 2.2.4, XWorks 1.2.1, Spring and hibernate on Windows development PC.
-
Patch
Description
Our software under development is using visitor validators to redirection the validation to the domain level objects. For example, I have an EditOfferAction class with the following EditOfferAction-validation.xml file.
<validators>
<field name="offer">
<field-validator type="visitor">
<message></message>
</field-validator>
</field>
</validators>
With the Offer class definition I have a Offer-validation.xml file containing:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
<field name="customerId">
<field-validator type="conversion" short-circuit="true">
<param name="repopulateField">true</param>
<message key="customerId.invalid"/>
</field-validator>
<field-validator type="int">
<param name="min">100000000</param>
<param name="max">999999999</param>
<message key="customerId.range.invalid" />
</field-validator>
</field>
</validators>
The issue we found is that when the action attempts to return to the data entry document with a conversion error, the value as entered by the user goes missing. I found that if I move the validation to the action and referred to offer.customerId then the value would be preserved. I then dug down into the XWorks source and noticed the following two lines:
164: fakeParams.put(fieldName, "'"tmpValue[0]"'");
173: fakeParams.put(fieldName, "'"tmpValue"'");
I then patched these two lines to look like this:
164: fakeParams.put(fullFieldName, "'"tmpValue[0]"'");
173: fakeParams.put(fullFieldName, "'"tmpValue"'");
This worked for me and now I can do conversion validation at the domain level and have the user entered values preserved.
Have I got this right ?
ciao
Derek
Attachments
Issue Links
- Is contained by
-
XW-411 OgnlValueStack cannot handle mulitple overrides.
- Resolved