struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mael Le Guével <>
Subject JSONValidationInterceptor and quotes
Date Tue, 09 Apr 2013 06:50:46 GMT
Hello there,
I am using struts JSON plugin to do some ajax requests. And I am
facing a problem with
Everything works fine as long as my validation error messages do not
contain single quotes. When there are quotes, the client side library
"crashes" because it does not seem to be able to parse the generated
JSON. Here is the JSON:
    "fieldErrors": {
        "password": [
            "Password isn\'t correct"

The problem comes from the escaped quote. Apparently, not all JSON
implementations accept escaped single quotes.
I can get rid of the client side error by creating a new interceptor,
inheriting from org.apache.struts2.json.JSONValidationInterceptor, and
overriding the buildResponse(ValidationAware) function to not escape
single quotes. But that does not seem to be a good solution in the
long run. Does someone have a better solution?

Thank you :)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message