You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Vladimir Limansky (JIRA)" <ji...@apache.org> on 2009/03/12 19:03:02 UTC
[jira] Created: (WW-3035) JSONValidationInterceptor builds
incorrect responce if only action errors are enabled
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.
[jira] Commented: (WW-3035) JSONValidationInterceptor builds
incorrect responce if only action errors are enabled
Posted by "Vladimir Limansky (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3035?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45715#action_45715 ]
Vladimir Limansky commented on WW-3035:
---------------------------------------
Oh, sorry, Wes has just givven me the clue.
> 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.
[jira] Updated: (WW-3035) JSONValidationInterceptor builds
incorrect responce if only action errors are enabled
Posted by "Vladimir Limansky (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3035?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vladimir Limansky updated WW-3035:
----------------------------------
Attachment: JSONValidationInterceptor.patch
We do not need extra comma in the end of JSON if we have only action errors, but do not have field errors
> 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.
[jira] Commented: (WW-3035) JSONValidationInterceptor builds
incorrect responce if only action errors are enabled
Posted by "Vladimir Limansky (JIRA)" <ji...@apache.org>.
[ 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.
[jira] Resolved: (WW-3035) JSONValidationInterceptor builds
incorrect responce if only action errors are enabled
Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
[ 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.
[jira] Commented: (WW-3035) JSONValidationInterceptor builds
incorrect responce if only action errors are enabled
Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3035?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45710#action_45710 ]
Musachy Barroso commented on WW-3035:
-------------------------------------
Thanks for reporting. You can create a diff file and submit it to this ticket.
> 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.