0

I am using Struts validation by extending action to ActionSupport.

When I try to put special character on the UI, then default actionErrors are adding up in the collections like Illegal characters were detected in the input, please remove them and try again.

Then I need to remove that default validation coming up on UI. I have no idea to deal with it.

My code is like this:

void validate(){  
    if (locationBean.getReasonTypeId() == 0)  
   {  
     addActionError("Error in reason");  
    }  
      if (ValidationHelper.checkRequiredField(locationBean.getName()))  
    {  
      addActionError("Error in Location name");  
    }  
}  

My validation action class is like this:

public class ValidationErrorJSONAction extends ActionSupport  
{  
  private JSONObject jsonObject;  

  @SuppressWarnings("unchecked")  
  public String execute() throws Exception  
  {    
    jsonObject = new JSONObject();  
    jsonObject.put("actionErrors", new JSONArray(getActionErrors()));  
    jsonObject.put("fieldErrors",new JSONObject(getFieldErrors()));  
    TokenHelperJSON.appendToken(jsonObject);  

    return SUCCESS;  
  }  

Hope it will help you to understand the problem.

Cœur
  • 37,241
  • 25
  • 195
  • 267
ankit
  • 438
  • 10
  • 26
  • Do you use a config files, if so post it here. – Roman C Jan 18 '13 at 10:53
  • You don't need to shutdown the validation, but to setup a correct Encoding through your application. Refer to the great explanation by BalusC here: http://stackoverflow.com/questions/14177914/passing-turkish-char-from-form-to-java-class-with-struts2 – Andrea Ligios Jan 18 '13 at 14:01

0 Answers0