Hi! I wrote some scenario for the issue [1]. In the source code of
class org.apache.shale.component.Token, method public void
validate(FacesContext context) i saw the following:
// If any of the other input components in this form triggered
// validation errors, we do NOT want to validate the token component
// here, because that would erase the saved token and prevent the
// subsequent valid resubmit from succeeding.
//
// WARNING - for this test to be successful, the token component must
// be the last input component child of the parent form to be
// processed
if (context.getMaximumSeverity() != null) {
return;
}
In my case there is an error when i submit the page so the maximum
severity is not null. I modified the code so i get:
if (context.getMaximumSeverity() != null) {
//putting null here will cause NPE
getAttributes().put(TOKEN_ATTRIBUTE_KEY,"");
return;
}
and in the public String getToken() i changed the condition
if (value != null && !value.equals("")) {
return value;
}
With this code the token works as expected now but only if its the
last input component in the form.
[1] http://issues.apache.org/struts/browse/SHALE-287
--
Seeing is believing