This discussion is archived
13 Replies Latest reply: Jun 17, 2009 6:07 AM by 807588 RSS

Oracle ADF breakline in JAVA

807588 Newbie
Currently Being Moderated
I'm using oracle adf to display a table.

The results in my 'notes' field have /n in the table to represent a new line. Oracle ADF does not separate the lines. I want to manually modify the string to display the break line.

The string looks like: return new String(getAttributeInternal(NOTES).toString().replace("\n", "\n"));

That however is not working, anyone know a working solution?
  • 1. Re: Oracle ADF breakline in JAVA
    807588 Newbie
    Currently Being Moderated

  • 2. Re: Oracle ADF breakline in JAVA
    807588 Newbie
    Currently Being Moderated
    Tried that. No go.
  • 3. Re: Oracle ADF breakline in JAVA
    807588 Newbie
    Currently Being Moderated
    What happens when the output has <br> in it? "No go" is a vague.
  • 4. Re: Oracle ADF breakline in JAVA
    807588 Newbie
    Currently Being Moderated
    return new String(getAttributeInternal(NOTES).toString().replace("\n", "<br/>"));

    I get a bunch of
    's in the string where a break should be.

    That would probably work if I could escape it some how.
  • 5. Re: Oracle ADF breakline in JAVA
    807588 Newbie
    Currently Being Moderated
    Dayke wrote:
    return new String(getAttributeInternal(NOTES).toString().replace("\n", "<br/>"));

    I get a bunch of
    's in the string where a break should be.

    That would probably work if I could escape it some how.
    This really is an ADF question and shouldn't be asked in this forum.

    You won't be able to "escape" this, you'll have to see what you can do in ADF. It would appear that somewhere ADF is using something like JSTL out to properly escape any HTML it finds. So the bottom line is that you would have to use HTML, but you can't either. So you'll have to read the relevant documentation and see what you might be able to do. I would suggest that you probably don't actually really want to insert line breaks at all but just format the width of the containing element appropriately. Not using something like out makes your application open to cross-site scripting attacks.
  • 6. Re: Oracle ADF breakline in JAVA
    807588 Newbie
    Currently Being Moderated
    Dayke wrote:
    return new String(getAttributeInternal(NOTES).toString().replace("\n", "<br/>"));

    I get a bunch of
    's in the string where a break should be.

    That would probably work if I could escape it some how.
    Aside: note there's no need to new String -- replace returns a string, after all.

    It sounds like the framework is quoting
    , turning it into &lt;br/&gt; for example. I don't know ADF, but often tags that do with will have an attribute you can set to turn off the quoting.
  • 7. Re: Oracle ADF breakline in JAVA
    807588 Newbie
    Currently Being Moderated
    You were right bigdaddy,

    The outputtextbox that was holding the query result had a property: escape="false" once I made that true,
    worked.
  • 8. Re: Oracle ADF breakline in JAVA
    807588 Newbie
    Currently Being Moderated
    Dayke wrote:
    You were right bigdaddy,

    The outputtextbox that was holding the query result had a property: escape="false" once I made that true,
    worked.
    But note well what cotton.m pointed out. If you don't control that text -- say if it's something you let the user enter or edit, they can hack your page.
  • 9. Re: Oracle ADF breakline in JAVA
    807588 Newbie
    Currently Being Moderated
    It's in a read only data bound control table...


    Thanks!
  • 10. Re: Oracle ADF breakline in JAVA
    807588 Newbie
    Currently Being Moderated
    Oracle ADF is a JSF component library (which is since ages taken over by Apache under the name Trinidad). You should in fact have posted this thread in the JavaServer Faces forum, not in the Java Programming forum.

    Alternatively -and often better because the JSF forum here often only handles the Sun reference implementation- you can also use the component library's own forum/mailinglist at their own website. In this case, Oracle has just a JDeveloper forum where you can post ADF specific questions in.

    Good luck.
  • 11. Re: Oracle ADF breakline in JAVA
    807588 Newbie
    Currently Being Moderated
    if you want render this in front end, try <af:outputFormatted>
    http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/tagdoc/core/outputFormatted.html
  • 12. Re: Oracle ADF breakline in JAVA
    jwenting Journeyer
    Currently Being Moderated
    BalusC wrote:
    Oracle ADF is a JSF component library (which is since ages taken over by Apache under the name Trinidad). You should in fact have posted this thread in the JavaServer Faces forum, not in the Java Programming forum.
    It's actually under active development by Oracle under that name, Apache has a fork.
    ADF is larger than just the JSF components (though those are the most commonly used parts).
    Alternatively -and often better because the JSF forum here often only handles the Sun reference implementation- you can also use the component library's own forum/mailinglist at their own website. In this case, Oracle has just a JDeveloper forum where you can post ADF specific questions in.
    OTN has a dedicated ADF forum and I think also a dedicated ADF Faces forum.
  • 13. Re: Oracle ADF breakline in JAVA
    807588 Newbie
    Currently Being Moderated
    jwenting wrote:
    BalusC wrote:
    Oracle ADF is a JSF component library (which is since ages taken over by Apache under the name Trinidad). You should in fact have posted this thread in the JavaServer Faces forum, not in the Java Programming forum.
    It's actually under active development by Oracle under that name, Apache has a fork.
    Ah yes, Trinidad is just a fork, din't knew that. Thanks for the info :)