[
https://issues.apache.org/struts/browse/STR-1964?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul Benedict updated STR-1964:
-------------------------------
Description:
The problem is that after form validate method returns the collection of errors
it's hard to separate them into errors and messages. Very frequently there is a
need to render errors differently than the messages. The suggestion is to add
attributes errorsOnly=�true/[false]� to the html:errors and
messagesOnly=�true/
[false]� to the html:messages tags. It’s very simple enhancement but it
will
definitely be used a lot.
The ErrorsTag would have to be modified slightly to cast to ActionMessage base
class instead of ActionError and then the check for ActionError:
ActionMessage report = (ActionMessage)iter.next();
If(isErrorsOnly() && !(report instanceof ActionError)) continue;
Similarly, the MessagesTag can be enhanced to show only messages, ignoring the
errors:
ActionMessage report = (ActionMessage)iter.next();
If(isMessagesOnly() && report instanceof ActionError) continue;
Then in the action form’s validate method both ActionError and ActionMessage
instances can be added to the ActionErrors collection and then displayed
differently by html:errors and html:messages tags.
Note. There is currently a message attribute in the html:messages tag but
it’s
not a convenient way to separate errors and messages in the action form.
was:
The problem is that after form validate method returns the collection of errors
it's hard to separate them into errors and messages. Very frequently there is a
need to render errors differently than the messages. The suggestion is to add
attributes errorsOnly=âtrue/[false]â to the html:errors and
messagesOnly=âtrue/
[false]â to the html:messages tags. Itâs very simple enhancement but it
will
definitely be used a lot.
The ErrorsTag would have to be modified slightly to cast to ActionMessage base
class instead of ActionError and then the check for ActionError:
ActionMessage report = (ActionMessage)iter.next();
If(isErrorsOnly() && !(report instanceof ActionError)) continue;
Similarly, the MessagesTag can be enhanced to show only messages, ignoring the
errors:
ActionMessage report = (ActionMessage)iter.next();
If(isMessagesOnly() && report instanceof ActionError) continue;
Then in the action formâs validate method both ActionError and ActionMessage
instances can be added to the ActionErrors collection and then displayed
differently by html:errors and html:messages tags.
Note. There is currently a message attribute in the html:messages tag but
itâs
not a convenient way to separate errors and messages in the action form.
Fix Version/s: 1.4.0
Assignee: (was: Struts Developers)
> [taglib] errors messages tags enhancement: make them show only errors/messages
> ------------------------------------------------------------------------------
>
> Key: STR-1964
> URL: https://issues.apache.org/struts/browse/STR-1964
> Project: Struts 1
> Issue Type: Improvement
> Components: Taglibs
> Affects Versions: 1.1.0
> Environment: Operating System: other
> Platform: Other
> Reporter: Pavel
> Priority: Minor
> Fix For: 1.4.0
>
>
> The problem is that after form validate method returns the collection of
> errors
> it's hard to separate them into errors and messages. Very frequently there is
> a
> need to render errors differently than the messages. The suggestion is to add
> attributes errorsOnly=�true/[false]� to the html:errors and
> messagesOnly=�true/
> [false]� to the html:messages tags. It’s very simple enhancement but it
> will
> definitely be used a lot.
> The ErrorsTag would have to be modified slightly to cast to ActionMessage
> base
> class instead of ActionError and then the check for ActionError:
> ActionMessage report = (ActionMessage)iter.next();
> If(isErrorsOnly() && !(report instanceof ActionError)) continue;
> Similarly, the MessagesTag can be enhanced to show only messages, ignoring
> the
> errors:
> ActionMessage report = (ActionMessage)iter.next();
> If(isMessagesOnly() && report instanceof ActionError) continue;
> Then in the action form’s validate method both ActionError and
> ActionMessage
> instances can be added to the ActionErrors collection and then displayed
> differently by html:errors and html:messages tags.
> Note. There is currently a message attribute in the html:messages tag but
> it’s
> not a convenient way to separate errors and messages in the action form.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.