Uploaded image for project: 'Struts 1'
  1. Struts 1
  2. STR-1964

[taglib] errors messages tags enhancement: make them show only errors/messages

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.1.0
    • 1.4.x
    • Tag Libraries
    • None
    • Operating System: other
      Platform: Other
    • 26668

    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.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            olgt@yahoo.com Pavel

            Dates

              Created:
              Updated:

              Slack

                Issue deployment