• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

print html tag inside xhtml

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a test.xhtml page using primefaces
I generated html tags in TestBean , and the string content = "<style> .textAreaStyle{width:200px;color:red} </style>"
I need to add the string inside the <head> </head> of html

 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please do not post the same question repeatedly. It will not get answered any faster. We don't get paid for doing this, so it can take a day or more before you get responses.

You can use the "escape" attribute on an outputText element to emit raw HTML from a backing bean.

Having said that, however, I recommend avoiding doing that whereever possible. My experience (not just in JSF) is that it can make a real mess of things.

You can also code raw HTML on the View Definition (xhtml) itself. Usually these days you just code it as straight HTML, but you can also use the "f:verbatim" tag to wrap the HTML if you have problems.
 
Nesrin aboud
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the forums site was down while i was adding the post , and i was refreshing the page, after that i found the multiple posts for the same questions and did not know how to delete it, please check your inbox, I sent you for this problem , and thank you for your answer, I will try it
 
Nesrin aboud
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I used the outputText

and the result was


when I used the <f:verbatim> tag

nothing was found in the html with escape=true or false

it worked fine without using this tag "f:verbatim", would please tell me what is its importance in this case?
 
Tim Holloway
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry about the issues with the CodeRanch Server. Such things happen, unfortunately.

The "verbatim" tag was designed for JSF version 1, which initially leveraged JSPs. JSPs are compiled into linear Java code, but JSF works by compiling into a 2-dimensional component tree. As a result, loose HTML (and other things) could become lost or misplaced on the resulting output page. The "verbatim" tag bundled such items up in little packages and made sure that they got attached to the component tree in the places where they would be rendered at the right location (more or less). Later JSF versions became better capable of handling such loose text without assistance.

There is no "escape" attribute for the "verbatim" tag, however. The body of the element itself is "escaped", so it would be redundant to say so.
 
Nesrin aboud
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much
 
reply
    Bookmark Topic Watch Topic
  • New Topic