[ 
https://issues.apache.org/struts/browse/WW-3035?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45714#action_45714
 ] 

Vladimir Limansky commented on WW-3035:
---------------------------------------

Musachy,
The only fix for now is 
instead of
            if (validationAware.hasActionErrors()) {
                sb.append("\"errors\":");
                sb.append(buildArray(validationAware.getActionErrors()));
                sb.append(",");
            }
should be
            if (validationAware.hasActionErrors()) {
                sb.append("\"errors\":");
                sb.append(buildArray(validationAware.getActionErrors()));
                if (validationAware.hasFieldErrors()) {
                 sb.append(",");
                }
            } 

In JSONValidationInterceptor - that's for the server side. 
But, honesly, I do not know how to create a diff file for this change.

As for client side, I'm going to make some client fixes, handling action errors 
with ajax validation and want to submit them to struts project either.
The struts version we're using now is 2.1.0 and we do not have time to migrate 
rigth now. So I need to find an approach how to 'override' some *.js files. 
Please take a look at https://issues.apache.org/struts/browse/WW-3036

> JSONValidationInterceptor builds incorrect responce if only action errors are 
> enabled
> -------------------------------------------------------------------------------------
>
>                 Key: WW-3035
>                 URL: https://issues.apache.org/struts/browse/WW-3035
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>    Affects Versions: 2.1.0
>         Environment: struts2-core-2.1.0.jar struts2-dojo-plugin-2.1.0.jar
>            Reporter: Vladimir Limansky
>
> 1. Let's take a look at 
> org.apache.struts2.interceptor.validation.JSONValidationInterceptor 
> buildResponce method
> instead of 
>             if (validationAware.hasActionErrors()) {
>                 sb.append("\"errors\":");
>                 sb.append(buildArray(validationAware.getActionErrors()));
>                 sb.append(",");
>             }
> should be 
>             if (validationAware.hasActionErrors()) {
>                 sb.append("\"errors\":");
>                 sb.append(buildArray(validationAware.getActionErrors()));
>                 if (validationAware.hasFieldErrors()) {
>                       sb.append(",");
>                 }
>             }
> Because if there are no field errors, but only action errors, incorrect JSON 
> object is built.
> 2. This issue relates to https://issues.apache.org/struts/browse/WW-2609.
> I want to make a fix for my local project, but I'm not sure what is the best 
> place to display action errors. Personally, displaying actions errors just 
> above the form submitted is not the best place. Probably it would be better 
> to extend actionerror.ftl by adding a label(div element) where I can place 
> action error messages for ajax validation. What do you think?
> 3. I want to submit some fixes into the struts project. How I can obtain the 
> permissions to participate?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to