File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes jsf render < and > to < and > Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "jsf render < and > to &lt; and &gt;" Watch "jsf render < and > to &lt; and &gt;" New topic

jsf render < and > to &lt; and &gt;

reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
I'm using JSF 2 to dynamically generate some
  • tags, and use the tool, 'Smooth Navigational Menu' at to display a cascading dropdown menu.

    After the page loads up, the dropdown doesn't behave correctly. When I look at the source code, it is <ul> and <li> instead of
    • which is why the javascript code failed to build up the rich menu.

      Does anyone one know how should I solve this problem? Thanks.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

Apparently you're getting too clever, since it looks like even in your posted example not all the characters are displaying.

It looks like what you're trying to use is some sort of CSS/JavaScript-based menu system. You might find it easier to work with an actual JSF menu component like one from Apache Tomahawk, RichFaces, or IceFaces.

As far as the actual character rendering goes, normally JSF will escape the "dangerous" ones automatically. However that also means that if you attempt to ram in HTML from a backing bean by brute force, you won't get the HTML, you'll get the escaped version of the HTML. The hutputText control is one of the few ways to actually inject raw HTML programmatically into a JSF view, since as a general rule, JSF prefers to enforce the separation of Model, View and Controller.

An IDE is no substitute for an Intelligent Developer.
reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
Thanks Tim.

I often use javascript to enforce some change on html, rather that to use some third party framework. I know it's not always the best way to do, but I think it's also not uncommon to have business logic, or control, in javascript in many populate websites.

I looked into richfaces and icefaces. I found a good example for icefaces ( Then I used icefaces-2.0.0-Beta-1 to integrated with my jsf 2 code.

But the page does not show up any html for icefaces tags, when I use firebug to look at them, the code are there, but its in grey color, looks like been hidden, and I found some code being inserted:

It looks like been added by icefaces. But why the <ice:menuBar>, <ice:menuItem> tags are not displayed at all?
I agree. Here's the link:
subject: jsf render < and > to &lt; and &gt;
jQuery in Action, 3rd edition