You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Musachy Barroso (JIRA)" <ji...@apache.org> on 2009/03/20 14:26:04 UTC

[jira] Resolved: (WW-3035) JSONValidationInterceptor builds incorrect responce if only action errors are enabled

     [ https://issues.apache.org/struts/browse/WW-3035?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Musachy Barroso resolved WW-3035.
---------------------------------

    Resolution: Not A Problem

This was a problem in 2.1.0 but was fixed at a later time, thanks for reporting and the patch.

> 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
>         Attachments: JSONValidationInterceptor.patch
>
>
> 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.