File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts2 form input tag's cssErrorClass is not being rendered for server side validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 form input tag Watch "Struts2 form input tag New topic
Author

Struts2 form input tag's cssErrorClass is not being rendered for server side validation

J Livermore
Greenhorn

Joined: Nov 22, 2011
Posts: 5
I have a Struts2 input form tag defined as:

<s:radio name="jointAccount" list="#{'yes':'yes','no':'no'}" required="true" cssErrorClass="fv_error"/>

And when I do server side validation in my ActionClass:

if(jointAccount == null || jointAccount.isEmpty()) {
this.addFieldError("jointAccount", "JOINT is required.");
return INPUT;
}

The rendered form element does not have the cssErrorClass:

<input type="radio" name="jointAccount" id="step2_jointAccountyes" value="yes"/><label for="step2_jointAccountyes">yes</label>
<input type="radio" name="jointAccount" id="step2_jointAccountno" value="no"/><label for="step2_jointAccountno">no</label>

I've even tried writing a custom Validator by extending ValidatorSupport, adding the class as a new validator entry in validators.xml and then using that custom validator in the ActionClassName-validation.xml file, and still cannot get the cssErrorClass to render upon a validation error.

Any thoughts?
J Livermore
Greenhorn

Joined: Nov 22, 2011
Posts: 5
This has been fixed for Release 2.3.1 - Jira WW-3712
J Livermore
Greenhorn

Joined: Nov 22, 2011
Posts: 5
For those looking for a work around here is an example:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts2 form input tag's cssErrorClass is not being rendered for server side validation
 
Similar Threads
Struts2 label tag - key attribute is being replaced with actual value?
Struts2 & validation [SOLVED]
struts2 radio button validation
validation in struts2
struts2 action-method-validation.xml not working?