You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lukasz Racon (JIRA)" <ji...@apache.org> on 2007/07/20 19:30:13 UTC
[jira] Created: (WW-2050) Separate JSONValidationInterceptor from
AnnotationValidationInterceptor
Separate JSONValidationInterceptor from AnnotationValidationInterceptor
-----------------------------------------------------------------------
Key: WW-2050
URL: https://issues.apache.org/struts/browse/WW-2050
Project: Struts 2
Issue Type: Improvement
Components: Interceptors
Affects Versions: 2.1.0
Reporter: Lukasz Racon
Priority: Minor
Attachments: jsonvalidator.diff
Since JSONValidationInterceptor extends AnnotationValidationInterceptor it should behave exactly as AnnotationValidationInterceptor does.
Here are the problems:
- JSONValidationInterceptor ignores @SkipValidation
- it always performs jason validation. You have to have separate stacks for different validation strategies. IMHO as a replacement it should as default let the workflow/annotationWorkflow controller to decide what to do.
- JSON validation should be triggered by a request parameter (for example set by the sx:submit tag, or to be precise by Bind widget)
Proposed solution:
JSONValidationInterceptor should be an interceptor (not a validating one). It should be positioned in the stack after the 'validation' and before 'workflow'. This way its sole purpose would be to check for request param trigger and action that has errors and return errors as json. Other interceptors will be responsible for validation and setting the errors on the action. This setup would allow JSON validation to coexist with old submit form validation - meaning you would have one stack for both.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (WW-2050) Separate JSONValidationInterceptor from
AnnotationValidationInterceptor
Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-2050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Musachy Barroso reassigned WW-2050:
-----------------------------------
Assignee: Musachy Barroso
> Separate JSONValidationInterceptor from AnnotationValidationInterceptor
> -----------------------------------------------------------------------
>
> Key: WW-2050
> URL: https://issues.apache.org/struts/browse/WW-2050
> Project: Struts 2
> Issue Type: Improvement
> Components: Interceptors
> Affects Versions: 2.1.0
> Reporter: Lukasz Racon
> Assignee: Musachy Barroso
> Priority: Minor
> Attachments: jsonvalidator.diff
>
>
> Since JSONValidationInterceptor extends AnnotationValidationInterceptor it should behave exactly as AnnotationValidationInterceptor does.
> Here are the problems:
> - JSONValidationInterceptor ignores @SkipValidation
> - it always performs jason validation. You have to have separate stacks for different validation strategies. IMHO as a replacement it should as default let the workflow/annotationWorkflow controller to decide what to do.
> - JSON validation should be triggered by a request parameter (for example set by the sx:submit tag, or to be precise by Bind widget)
> Proposed solution:
> JSONValidationInterceptor should be an interceptor (not a validating one). It should be positioned in the stack after the 'validation' and before 'workflow'. This way its sole purpose would be to check for request param trigger and action that has errors and return errors as json. Other interceptors will be responsible for validation and setting the errors on the action. This setup would allow JSON validation to coexist with old submit form validation - meaning you would have one stack for both.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WW-2050) Separate JSONValidationInterceptor from
AnnotationValidationInterceptor
Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-2050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_41968 ]
Musachy Barroso commented on WW-2050:
-------------------------------------
The ticket for removing the validation code from the workflow interceptor is WW-2072
> Separate JSONValidationInterceptor from AnnotationValidationInterceptor
> -----------------------------------------------------------------------
>
> Key: WW-2050
> URL: https://issues.apache.org/struts/browse/WW-2050
> Project: Struts 2
> Issue Type: Improvement
> Components: Interceptors
> Affects Versions: 2.1.0
> Reporter: Lukasz Racon
> Assignee: Musachy Barroso
> Priority: Minor
> Fix For: 2.1.0
>
> Attachments: jsonvalidator.diff, validation2.js
>
>
> Since JSONValidationInterceptor extends AnnotationValidationInterceptor it should behave exactly as AnnotationValidationInterceptor does.
> Here are the problems:
> - JSONValidationInterceptor ignores @SkipValidation
> - it always performs jason validation. You have to have separate stacks for different validation strategies. IMHO as a replacement it should as default let the workflow/annotationWorkflow controller to decide what to do.
> - JSON validation should be triggered by a request parameter (for example set by the sx:submit tag, or to be precise by Bind widget)
> Proposed solution:
> JSONValidationInterceptor should be an interceptor (not a validating one). It should be positioned in the stack after the 'validation' and before 'workflow'. This way its sole purpose would be to check for request param trigger and action that has errors and return errors as json. Other interceptors will be responsible for validation and setting the errors on the action. This setup would allow JSON validation to coexist with old submit form validation - meaning you would have one stack for both.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (WW-2050) Separate JSONValidationInterceptor from
AnnotationValidationInterceptor
Posted by "Lukasz Racon (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-2050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lukasz Racon updated WW-2050:
-----------------------------
Attachment: jsonvalidator.diff
patch
> Separate JSONValidationInterceptor from AnnotationValidationInterceptor
> -----------------------------------------------------------------------
>
> Key: WW-2050
> URL: https://issues.apache.org/struts/browse/WW-2050
> Project: Struts 2
> Issue Type: Improvement
> Components: Interceptors
> Affects Versions: 2.1.0
> Reporter: Lukasz Racon
> Priority: Minor
> Attachments: jsonvalidator.diff
>
>
> Since JSONValidationInterceptor extends AnnotationValidationInterceptor it should behave exactly as AnnotationValidationInterceptor does.
> Here are the problems:
> - JSONValidationInterceptor ignores @SkipValidation
> - it always performs jason validation. You have to have separate stacks for different validation strategies. IMHO as a replacement it should as default let the workflow/annotationWorkflow controller to decide what to do.
> - JSON validation should be triggered by a request parameter (for example set by the sx:submit tag, or to be precise by Bind widget)
> Proposed solution:
> JSONValidationInterceptor should be an interceptor (not a validating one). It should be positioned in the stack after the 'validation' and before 'workflow'. This way its sole purpose would be to check for request param trigger and action that has errors and return errors as json. Other interceptors will be responsible for validation and setting the errors on the action. This setup would allow JSON validation to coexist with old submit form validation - meaning you would have one stack for both.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Reopened: (WW-2050) Separate JSONValidationInterceptor from
AnnotationValidationInterceptor
Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-2050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Musachy Barroso reopened WW-2050:
---------------------------------
Reopening to fix reported problem when a field is a radiobutton list.
> Separate JSONValidationInterceptor from AnnotationValidationInterceptor
> -----------------------------------------------------------------------
>
> Key: WW-2050
> URL: https://issues.apache.org/struts/browse/WW-2050
> Project: Struts 2
> Issue Type: Improvement
> Components: Interceptors
> Affects Versions: 2.1.0
> Reporter: Lukasz Racon
> Assignee: Musachy Barroso
> Priority: Minor
> Fix For: 2.1.0
>
> Attachments: jsonvalidator.diff, validation2.js
>
>
> Since JSONValidationInterceptor extends AnnotationValidationInterceptor it should behave exactly as AnnotationValidationInterceptor does.
> Here are the problems:
> - JSONValidationInterceptor ignores @SkipValidation
> - it always performs jason validation. You have to have separate stacks for different validation strategies. IMHO as a replacement it should as default let the workflow/annotationWorkflow controller to decide what to do.
> - JSON validation should be triggered by a request parameter (for example set by the sx:submit tag, or to be precise by Bind widget)
> Proposed solution:
> JSONValidationInterceptor should be an interceptor (not a validating one). It should be positioned in the stack after the 'validation' and before 'workflow'. This way its sole purpose would be to check for request param trigger and action that has errors and return errors as json. Other interceptors will be responsible for validation and setting the errors on the action. This setup would allow JSON validation to coexist with old submit form validation - meaning you would have one stack for both.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (WW-2050) Separate JSONValidationInterceptor from
AnnotationValidationInterceptor
Posted by "Ted Husted (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-2050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ted Husted updated WW-2050:
---------------------------
Fix Version/s: Future
Setting Fix Version to "future" for issues without a set fix version.
> Separate JSONValidationInterceptor from AnnotationValidationInterceptor
> -----------------------------------------------------------------------
>
> Key: WW-2050
> URL: https://issues.apache.org/struts/browse/WW-2050
> Project: Struts 2
> Issue Type: Improvement
> Components: Interceptors
> Affects Versions: 2.1.0
> Reporter: Lukasz Racon
> Assignee: Musachy Barroso
> Priority: Minor
> Fix For: Future
>
> Attachments: jsonvalidator.diff
>
>
> Since JSONValidationInterceptor extends AnnotationValidationInterceptor it should behave exactly as AnnotationValidationInterceptor does.
> Here are the problems:
> - JSONValidationInterceptor ignores @SkipValidation
> - it always performs jason validation. You have to have separate stacks for different validation strategies. IMHO as a replacement it should as default let the workflow/annotationWorkflow controller to decide what to do.
> - JSON validation should be triggered by a request parameter (for example set by the sx:submit tag, or to be precise by Bind widget)
> Proposed solution:
> JSONValidationInterceptor should be an interceptor (not a validating one). It should be positioned in the stack after the 'validation' and before 'workflow'. This way its sole purpose would be to check for request param trigger and action that has errors and return errors as json. Other interceptors will be responsible for validation and setting the errors on the action. This setup would allow JSON validation to coexist with old submit form validation - meaning you would have one stack for both.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WW-2050) Separate JSONValidationInterceptor from
AnnotationValidationInterceptor
Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-2050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_41536 ]
Musachy Barroso commented on WW-2050:
-------------------------------------
I like this idea, thanks for the feedback!
> Separate JSONValidationInterceptor from AnnotationValidationInterceptor
> -----------------------------------------------------------------------
>
> Key: WW-2050
> URL: https://issues.apache.org/struts/browse/WW-2050
> Project: Struts 2
> Issue Type: Improvement
> Components: Interceptors
> Affects Versions: 2.1.0
> Reporter: Lukasz Racon
> Assignee: Musachy Barroso
> Priority: Minor
> Attachments: jsonvalidator.diff
>
>
> Since JSONValidationInterceptor extends AnnotationValidationInterceptor it should behave exactly as AnnotationValidationInterceptor does.
> Here are the problems:
> - JSONValidationInterceptor ignores @SkipValidation
> - it always performs jason validation. You have to have separate stacks for different validation strategies. IMHO as a replacement it should as default let the workflow/annotationWorkflow controller to decide what to do.
> - JSON validation should be triggered by a request parameter (for example set by the sx:submit tag, or to be precise by Bind widget)
> Proposed solution:
> JSONValidationInterceptor should be an interceptor (not a validating one). It should be positioned in the stack after the 'validation' and before 'workflow'. This way its sole purpose would be to check for request param trigger and action that has errors and return errors as json. Other interceptors will be responsible for validation and setting the errors on the action. This setup would allow JSON validation to coexist with old submit form validation - meaning you would have one stack for both.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (WW-2050) Separate JSONValidationInterceptor from
AnnotationValidationInterceptor
Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-2050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Musachy Barroso resolved WW-2050.
---------------------------------
Resolution: Fixed
> Separate JSONValidationInterceptor from AnnotationValidationInterceptor
> -----------------------------------------------------------------------
>
> Key: WW-2050
> URL: https://issues.apache.org/struts/browse/WW-2050
> Project: Struts 2
> Issue Type: Improvement
> Components: Core Interceptors
> Affects Versions: 2.1.0
> Reporter: Lukasz Racon
> Assignee: Musachy Barroso
> Priority: Minor
> Fix For: 2.1.1
>
> Attachments: jsonvalidator.diff, validation2.js
>
>
> Since JSONValidationInterceptor extends AnnotationValidationInterceptor it should behave exactly as AnnotationValidationInterceptor does.
> Here are the problems:
> - JSONValidationInterceptor ignores @SkipValidation
> - it always performs jason validation. You have to have separate stacks for different validation strategies. IMHO as a replacement it should as default let the workflow/annotationWorkflow controller to decide what to do.
> - JSON validation should be triggered by a request parameter (for example set by the sx:submit tag, or to be precise by Bind widget)
> Proposed solution:
> JSONValidationInterceptor should be an interceptor (not a validating one). It should be positioned in the stack after the 'validation' and before 'workflow'. This way its sole purpose would be to check for request param trigger and action that has errors and return errors as json. Other interceptors will be responsible for validation and setting the errors on the action. This setup would allow JSON validation to coexist with old submit form validation - meaning you would have one stack for both.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WW-2050) Separate JSONValidationInterceptor from
AnnotationValidationInterceptor
Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-2050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_41665 ]
Musachy Barroso commented on WW-2050:
-------------------------------------
I always for that about DefaultWorkflowInterceptor, I think it is a bug and I don't see any reason why validation should performed there at all. I will log an issue for it. As for the radiobuttons, I will reopen the issue to address that, I had no idea it was breaking there.
> Separate JSONValidationInterceptor from AnnotationValidationInterceptor
> -----------------------------------------------------------------------
>
> Key: WW-2050
> URL: https://issues.apache.org/struts/browse/WW-2050
> Project: Struts 2
> Issue Type: Improvement
> Components: Interceptors
> Affects Versions: 2.1.0
> Reporter: Lukasz Racon
> Assignee: Musachy Barroso
> Priority: Minor
> Fix For: 2.1.0
>
> Attachments: jsonvalidator.diff, validation2.js
>
>
> Since JSONValidationInterceptor extends AnnotationValidationInterceptor it should behave exactly as AnnotationValidationInterceptor does.
> Here are the problems:
> - JSONValidationInterceptor ignores @SkipValidation
> - it always performs jason validation. You have to have separate stacks for different validation strategies. IMHO as a replacement it should as default let the workflow/annotationWorkflow controller to decide what to do.
> - JSON validation should be triggered by a request parameter (for example set by the sx:submit tag, or to be precise by Bind widget)
> Proposed solution:
> JSONValidationInterceptor should be an interceptor (not a validating one). It should be positioned in the stack after the 'validation' and before 'workflow'. This way its sole purpose would be to check for request param trigger and action that has errors and return errors as json. Other interceptors will be responsible for validation and setting the errors on the action. This setup would allow JSON validation to coexist with old submit form validation - meaning you would have one stack for both.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (WW-2050) Separate JSONValidationInterceptor from
AnnotationValidationInterceptor
Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-2050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Musachy Barroso resolved WW-2050.
---------------------------------
Resolution: Fixed
Fix Version/s: (was: Future)
2.1.0
> Separate JSONValidationInterceptor from AnnotationValidationInterceptor
> -----------------------------------------------------------------------
>
> Key: WW-2050
> URL: https://issues.apache.org/struts/browse/WW-2050
> Project: Struts 2
> Issue Type: Improvement
> Components: Interceptors
> Affects Versions: 2.1.0
> Reporter: Lukasz Racon
> Assignee: Musachy Barroso
> Priority: Minor
> Fix For: 2.1.0
>
> Attachments: jsonvalidator.diff
>
>
> Since JSONValidationInterceptor extends AnnotationValidationInterceptor it should behave exactly as AnnotationValidationInterceptor does.
> Here are the problems:
> - JSONValidationInterceptor ignores @SkipValidation
> - it always performs jason validation. You have to have separate stacks for different validation strategies. IMHO as a replacement it should as default let the workflow/annotationWorkflow controller to decide what to do.
> - JSON validation should be triggered by a request parameter (for example set by the sx:submit tag, or to be precise by Bind widget)
> Proposed solution:
> JSONValidationInterceptor should be an interceptor (not a validating one). It should be positioned in the stack after the 'validation' and before 'workflow'. This way its sole purpose would be to check for request param trigger and action that has errors and return errors as json. Other interceptors will be responsible for validation and setting the errors on the action. This setup would allow JSON validation to coexist with old submit form validation - meaning you would have one stack for both.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Issue Comment Edited: (WW-2050) Separate
JSONValidationInterceptor from AnnotationValidationInterceptor
Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-2050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_41665 ]
musachy edited comment on WW-2050 at 8/21/07 4:13 PM:
--------------------------------------------------------------
I always forget that about the DefaultWorkflowInterceptor. I think it is a bug and I don't see any reason why validation should performed there at all. I will log an issue for it. As for the radiobuttons, I will reopen the issue to address that, I had no idea it was breaking there.
was (Author: musachy):
I always for that about DefaultWorkflowInterceptor, I think it is a bug and I don't see any reason why validation should performed there at all. I will log an issue for it. As for the radiobuttons, I will reopen the issue to address that, I had no idea it was breaking there.
> Separate JSONValidationInterceptor from AnnotationValidationInterceptor
> -----------------------------------------------------------------------
>
> Key: WW-2050
> URL: https://issues.apache.org/struts/browse/WW-2050
> Project: Struts 2
> Issue Type: Improvement
> Components: Interceptors
> Affects Versions: 2.1.0
> Reporter: Lukasz Racon
> Assignee: Musachy Barroso
> Priority: Minor
> Fix For: 2.1.0
>
> Attachments: jsonvalidator.diff, validation2.js
>
>
> Since JSONValidationInterceptor extends AnnotationValidationInterceptor it should behave exactly as AnnotationValidationInterceptor does.
> Here are the problems:
> - JSONValidationInterceptor ignores @SkipValidation
> - it always performs jason validation. You have to have separate stacks for different validation strategies. IMHO as a replacement it should as default let the workflow/annotationWorkflow controller to decide what to do.
> - JSON validation should be triggered by a request parameter (for example set by the sx:submit tag, or to be precise by Bind widget)
> Proposed solution:
> JSONValidationInterceptor should be an interceptor (not a validating one). It should be positioned in the stack after the 'validation' and before 'workflow'. This way its sole purpose would be to check for request param trigger and action that has errors and return errors as json. Other interceptors will be responsible for validation and setting the errors on the action. This setup would allow JSON validation to coexist with old submit form validation - meaning you would have one stack for both.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (WW-2050) Separate JSONValidationInterceptor from
AnnotationValidationInterceptor
Posted by "Lukasz Racon (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-2050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lukasz Racon updated WW-2050:
-----------------------------
Attachment: validation2.js
A couple more comments (beside great job):
1) previous one works well, except it ignores validation that is done in DefaultWorkflowInterceptor (Validateable interface, validateXXX methods).
IMHO, all validation should be in one place and DefaultWorkflowInterceptor should only decide what to show (result or input page). This way JSON validatior could have all the errors and could change the flow. (Note that it may break some apps.)
2) validation.js breaks on radio buttons:
utils.js/StrutsUtils.showValidationErrors provides addErrorXXX a form element
(errors.fieldErrors[fieldName]) - in case of radio buttons (checkboxes) this returns an array of fields; Array of fields is not a dom node and doesn't have a parent node - this fails within addErrorCSS;
3) validation.js/addErrorCSS depends too much on the layout
- form field's second parent must be 'wwgrp_'; So if you use custom template it will break; In attached file I am iterating over parent elements, and looking for one that has classname eq. to 'wwgrp'.
3) focusing on the first field that has error - it doesn't look like it is done. I overridden StrutsUtils.showValidationErrors - addErrorCSS stores the closest to the top of the page field position then focuses on it.
I am using attached validation2.js as a replacement of css_html/validation.js - it works well for me, although I cannot guarantee that it will work with all scenarios:)
Some of the stuff within could be applied to more general utilsjs/StrutsUtil javascript class, so it would work for xhtml theme as well.
> Separate JSONValidationInterceptor from AnnotationValidationInterceptor
> -----------------------------------------------------------------------
>
> Key: WW-2050
> URL: https://issues.apache.org/struts/browse/WW-2050
> Project: Struts 2
> Issue Type: Improvement
> Components: Interceptors
> Affects Versions: 2.1.0
> Reporter: Lukasz Racon
> Assignee: Musachy Barroso
> Priority: Minor
> Fix For: 2.1.0
>
> Attachments: jsonvalidator.diff, validation2.js
>
>
> Since JSONValidationInterceptor extends AnnotationValidationInterceptor it should behave exactly as AnnotationValidationInterceptor does.
> Here are the problems:
> - JSONValidationInterceptor ignores @SkipValidation
> - it always performs jason validation. You have to have separate stacks for different validation strategies. IMHO as a replacement it should as default let the workflow/annotationWorkflow controller to decide what to do.
> - JSON validation should be triggered by a request parameter (for example set by the sx:submit tag, or to be precise by Bind widget)
> Proposed solution:
> JSONValidationInterceptor should be an interceptor (not a validating one). It should be positioned in the stack after the 'validation' and before 'workflow'. This way its sole purpose would be to check for request param trigger and action that has errors and return errors as json. Other interceptors will be responsible for validation and setting the errors on the action. This setup would allow JSON validation to coexist with old submit form validation - meaning you would have one stack for both.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.