KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have one method in my managed bean which returns javascript as a string. When the method is invoked from head tag, it works fine. But when it is invoked from body , the browser instead of rendering the javascript writes it as it is. What can be the problem? In my JSF page when i do #{IndexBean.EastRegionGadgets} in head it works fine but it doesn't in body . It outputs the HTML as it is. Here is the code: package BusinessFacade; import java.util.ArrayList; import javax.annotation.PostConstruct; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; import javax.faces.component.html.HtmlOutputText; enum REGION{ NORTH,EAST,WEST; } class Gadget{ private String gadgetCode = ""; private REGION gadgetRegion = REGION.WEST; public Gadget(String gadgetCode, REGION gadgetRegion){ this.gadgetCode = gadgetCode; this.gadgetRegion = gadgetRegion; } public String getGadgetCode() { return gadgetCode; } public void setGadgetCode(String gadgetCode) { this.gadgetCode = gadgetCode; } public REGION getGadgetRegion() { return gadgetRegion; } public void setGadgetRegion(REGION gadgetRegion) { this.gadgetRegion = gadgetRegion; } } @ManagedBean(name="IndexBean") @RequestScoped public class IndexBean { ArrayList<Gadget> _list; public IndexBean() { } @PostConstruct public void initialize(){ _list = new ArrayList<Gadget>(); Gadget objGadget = new Gadget("<script type='text/javascript' src='http://cdn.widgetserver.com/syndication/subscriber/InsertWidget.js'></script><script>if (WIDGETBOX) WIDGETBOX.renderWidget('78d12c15-dc87-42f2-a78a-3f62a91a119a');</script><noscript>Get the <a href='http://www.widgetbox.com/widget/crystal-clock'>Crystal Clock</a> widget and many other <a href='h
Tags (comma-separated)
Save Edits
Cancel