11 Replies Latest reply: Mar 6, 2012 12:48 AM by Jan Vervecken RSS

    HTML tags returned from DCErrorMessage.getHTMLText() shown on the page

    Jan Vervecken
      hi

      Please consider this example application created using JDeveloper 11.1.1.3.0
      at http://www.consideringred.com/files/oracle/2010/GetHTMLTextTagsShownApp-v0.01.zip

      It basically implements what is documented in section "28.10.1 How to Customize the Detail Portion of a Message"
      at http://download.oracle.com/docs/cd/E14571_01/web.1111/b31974/web_adv.htm#ADFFD19884

      It has a MyStrongDCErrorMessage class implementing the getHTMLText() method like ...
      public class MyStrongDCErrorMessage
        implements DCErrorMessage
      {
        protected Exception fException = null;
      
        public MyStrongDCErrorMessage(Exception pException)
        {
          fException = pException;
        }
        
        public String getText()
        {
          return "(getText()) " + fException.getMessage();
        }
        
        public String getHTMLText()
        {
          return "(getHTMLText()) <strong>error</strong> : " + fException.getMessage();
        }
      }
      ... but at run-time the "strong" tag is shown on the page, as show in the screenshot in "getHTMLText-strong-tag-shown.png".

      question:
      - (q1) Should the HTML tags returned from the DCErrorMessage.getHTMLText() be shown on the page?
      - (q2) What is the meaning of "the detail portion a message" here as it is the only thing shown?

      many thanks
      Jan Vervecken
        • 1. Re: HTML tags returned from DCErrorMessage.getHTMLText() shown on the page
          Jan Vervecken
          fyi

          Because Re: af:table filter date format : task-flow navigation issue to get feedback, I created service request 3-2362392635 using My Oracle Support about (q1) and (q2).

          regards
          Jan
          • 2. Re: HTML tags returned from DCErrorMessage.getHTMLText() shown on the page
            Jan Vervecken
            fyi

            In the context of service request 3-2362392635 bug 10323682, "HTML TAGS RETURNED FROM DCERRORMESSAGE.GETHTMLTEXT() SHOWN ON THE PAGE", has been filed.

            regards
            Jan
            • 3. Re: HTML tags returned from DCErrorMessage.getHTMLText() shown on the page
              Jan Vervecken
              hi

              About (q2) I got this feedback in service request 3-2362392635 :
              "In JSF, messages are defined with a summary and detail
              http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/javax/faces/application/FacesMessage.html
              So the detail mentioning is for the JSF message part that describes the error details
              "

              As this feedback on (q2) is not very new or detailed, I had a look at components that work with FacesMessage:
              - like h:messages that has a showDetail attribute (although documented as being about "the summary portion" it seems to be about "the detail portion")
              at http://download.oracle.com/docs/cd/E17802_01/j2ee/j2ee/javaserverfaces/1.2/docs/tlddocs/h/messages.html
              - like af:messages that does not seem to document specific features for "the detail portion" of a FacesMessage
              at http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e12419/tagdoc/af_messages.html

              I have modified the example application ...
              at http://www.consideringred.com/files/oracle/2010/GetHTMLTextTagsShownApp-v0.02.zip
              ... to include an h:messages component like ...
              <h:messages id="m2" showDetail="true"/>
              ... and to allow for different DCErrorMessage implementations used for different types of RuntimeExceptions caused by different input parameter values:

              - scenario (sc1)
              An input parameter value starting with "err-runtime" causes a standard RuntimeException for which no specific DCErrorMessage implementation is returned in getDetailedDisplayMessage(), resulting in the exception message being used as FacesMessage summary and detail, as suggested by the screenshot
              at http://www.consideringred.com/files/oracle/img/2010/GHTTSApp-002-err-runtime.png

              - scenario (sc2)
              An input parameter value starting with "err-text-only" causes a MyTextOnlyRuntimeException for which a MyTextOnlyDCErrorMessage instance is returned in getDetailedDisplayMessage(), which only returns a String from getText() and null from getHTMLText(), and the getText() result becomes the FacesMessage detail, as suggested by the screenshot
              at at http://www.consideringred.com/files/oracle/img/2010/GHTTSApp-002-err-text-only.png

              - scenario (sc3)
              An input parameter value starting with "err-strong" causes a MyStrongRuntimeException for which a MyStrongDCErrorMessage instance is returned in getDetailedDisplayMessage(), which includes the HTML strong-tag in the getHTMLText() result, which becomes the FacesMessage detail, as suggested by the screenshot
              at http://www.consideringred.com/files/oracle/img/2010/GHTTSApp-002-err-strong.png
              (similar as in GetHTMLTextTagsShownApp-v0.01.zip resulting in (q1) and (q2))

              - scenario (sc4)
              An input parameter value starting with "err-wrap-html" causes a MyWrapHTMLStrongRuntimeException for which a MyWrapHTMLStrongDCErrorMessage is returned in getDetailedDisplayMessage(), implemented like this ...
              public class MyWrapHTMLStrongDCErrorMessage
                extends MyStrongDCErrorMessage
              {
                public MyWrapHTMLStrongDCErrorMessage(Exception pException)
                {
                  super(pException);
                }
              
                @Override
                public String getHTMLText()
                {
                  return "<html>(wrap-html) " + super.getHTMLText() + "</html>";
                }
              }
              ... which I tried because the af:messages documentation says "To include formatted text in an af:messages component, surround the text in the message attribute with <html> tags. ... Strings formatted with <html> tags are also supported for the detail string of a facesMessage. ",
              and as the result becomes the FacesMessage detail, it does have some effect on the error messages dialog where the strong-tags and the word "error" are no longer visible, as can be seen in the screenshot
              at http://www.consideringred.com/files/oracle/img/2010/GHTTSApp-002-err-wrap-html.png

              So, scenario's (sc3) and (sc4) seem to illustrate (or are related to) bug 10323682 .

              The scenario's (sc1) to (sc4) also suggest that ADF Faces components use the summary OR the detail of a FacesMessage, not both. Any comments or insight into this is always welcome.

              regards
              Jan
              • 4. Re: HTML tags returned from DCErrorMessage.getHTMLText() shown on the page
                Jan Vervecken
                fyi

                When asked for an alternative approach to include HTML markup in an error message, Oracle support could not provide such alternative (in SR 3-2362392635).

                Using JDeveloper 11.1.1.4.0 bug 10323682 can still be reproduced,
                see the screenshot at http://www.consideringred.com/files/oracle/img/2011/GHTTSApp-002-111140-err-strong.png

                regards
                Jan
                • 5. Re: HTML tags returned from DCErrorMessage.getHTMLText() shown on the page
                  832358
                  Hi,

                  We are facing the same issue with jDeveloper 11.1.1.4.0. I'm trying to resolve the problem right now. I'll post my advances if any.
                  • 6. Re: HTML tags returned from DCErrorMessage.getHTMLText() shown on the page
                    Jan Vervecken
                    hi "829355"
                    We are facing the same issue with jDeveloper 11.1.1.4.0. ...
                    Maybe, creating a service request referring to bug 10323682 to let Oracle know you would like to get this fixed could increase the chances of this being fixed in a future version. Or if you have a "business case" maybe even sooner.
                    ... I'll post my advances if any
                    Thanks in advance.

                    (tip : You can use "Your Control Panel" to make your name visible in forum posts.)

                    regards
                    Jan
                    • 7. Re: HTML tags returned from DCErrorMessage.getHTMLText() shown on the page
                      832358
                      Hi,

                      I´ll create the service request.

                      I have set my name visible, but it seems the system needs one hour to post the changes.

                      Thanks.

                      Jordi.
                      • 8. Re: HTML tags returned from DCErrorMessage.getHTMLText() shown on the page
                        832358
                        Just created the SR. Waiting for news.
                        • 9. Re: HTML tags returned from DCErrorMessage.getHTMLText() shown on the page
                          Jan Vervecken
                          fyi

                          Recently I noticed this being added in bug 10323682
                          *** 02/14/12 02:24 am *** (CHG: Sta->32)
                          resulting in "Status 32 - Not a Bug. To Filer".

                          Because re-opening SR 3-2362392635 was not possible, a new SR had to be created (3-5347433853) to get some feedback on the change in bug 10323682 because no details were visible, resulting in:
                          Here is an extract on what development specified in Bug 10323682 - HTML TAGS RETURNED FROM DCERRORMESSAGE.GETHTMLTEXT() SHOWN ON THE PAGE

                          "For include formatted test in the error message, &lt;html&gt; tags should be used for enclosing the text.
                          Also, on testing I found that &lt;strong&gt; tag is not working in this case. As mentioned in sc 4, the entire text enclosed in strong-tag is not displayed. Please try using &lt;b&gt; tag instead of strong-tag. This displays the error message properly. Meanwhile I am further analyzing why strong-tag is not working."

                          This is the last update on bug before it was marked as not a bug:
                          "strong-tag is not a legal tag for text formatting which are supported by ADF.. As a result, the tag and its contents are removed when the html is cleaned.
                          The legal html tags in ADF for formatted text are as follows: SPAN, B, A, I, EM, BR, HR, LI, OL, UL, P, TT, BIG, SMALL, PRE.
                          Closing as not a bug."
                          Taking this into account, in the modified example application
                          at http://www.consideringred.com/files/oracle/2012/GetHTMLTextTagsShownApp-v0.03.zip
                          I added code to support a scenario (sc5):
                          An input parameter value starting with "err-wrap-legal-html" causes a MyWrapLegalHTMLRuntimeException for which a MyWrapLegalHTMLDCErrorMessage is returned in getDetailedDisplayMessage().
                          This results in expected behaviour, as shown in the screenshot
                          at http://www.consideringred.com/files/oracle/img/2012/GHTTSApp-003-err-wrap-legal-html.png

                          In SR 3-5347433853 I have asked
                          - (q3) Where can 'the legal html tags in ADF for formatted text' be found in the Oracle documentation?

                          Because feedback in bug 10323682 says "<html> tags should be used for enclosing the text"
                          it seems that the documented "Example 28-29" is not correct, as illustrated by scenario (sc6):
                          An input parameter value starting with "err-example2829" causes a MyExample2829RuntimeException for which a MyExample2829DCErrorMessage is returned in getDetailedDisplayMessage() resulting in HTML tags returned from DCErrorMessage.getHTMLText() shown on the page, as shown in the screenshot
                          at http://www.consideringred.com/files/oracle/img/2012/GHTTSApp-003-err-example2829.png

                          - (q4) Is documentation "Example 28-29" (in Part Number B31974-06 ) a documentation bug?

                          regards
                          Jan Vervecken
                          • 10. Re: HTML tags returned from DCErrorMessage.getHTMLText() shown on the page
                            Jan Vervecken
                            fyi

                            - about (q3)
                            -- resulted in bug 13800264 (currently unpublished, or not to be found on My Oracle Support, for unclear reasons)
                            - about (q4)
                            -- resulted in bug 13800529 , "CODE ERROR ON HOW TO CUSTOMIZE THE DETAIL PORTION OF A MESSAGE SECTION"

                            regards
                            Jan
                            • 11. Re: HTML tags returned from DCErrorMessage.getHTMLText() shown on the page
                              Jan Vervecken
                              fyi

                              Today it seems to be possible to find bug 13800264 , "LEGAL HTML TAGS IN ADF FOR FORMATTED TEXT", on My Oracle Support.

                              regards
                              Jan