Show HTML formatting in Oracle ADF

Quick Tip- If you have html content stored in database in string and you want to display same html formatting in ADF.

Use escape attribute in outputText’s escape attribute.You can also try outputFormatted also.In outputFormatted there is no escape property.

     <af:outputText value="&lt;h2>&lt;b>Techartifact&lt;/b>&lt;/h2>" id="ot1"
          <af:outputFormatted value="&lt;h2>&lt;b>Techartifact&lt;/b>&lt;/h2>" id="of1"/>

and output wil be like below


Happy learning with Vinay Kumar in techartifact.

Get value of the outputtext in javascript and access to backing bean in Oracle ADF

Requirement -Get value of the outputtext in javascript and send it to backing bean in Oracle ADF
Solution – We will use clientListener to call java script function and Serverlistener for calling java function

Below is the code for accomplish this

– page code

    <af:outputText value="value outputText" id="ot32" clientComponent="true"
        <af:clientListener type="mouseOver"
        <af:serverListener type="mycustomserverEvent" method="#{OutputTextCase11.handleServerEvent}"/>                
    <af:outputText value="Init" shortDesc="shortDesc" id="ot1" clientComponent="true"/>

– find javascript function code

   var customJsFunction = function(event)
      var exceptiondata = event.getSource().findComponent("ot32").getValue();
      return true;

– method in bean

  public void handleServerEvent(ClientEvent ce)
    String param = (String)ce.getParameters().get("param1");
    RichOutputText outputText=(RichOutputText)ce.getComponent().findComponent("ot1");

happy coding with Vinay in techartifact….

wraping text in outputText in Oracle ADF

Requirement- Wraping long text in outputText

Solutions- Many developer find solution to convert to input text and make read only.But that is just a work around.
Try this in inline Style – width:180px;display:inline-block;word-wrap:break-word
make nowrap property to false.


That’s it.

Happy coding with Vinay Kumar in techartifact….