I want to generate some html code for the jsf page I have (I am not on jsp so I cannot use out.print), so I use icefaces component ice:outputText:
<ice:outputText id="txtCaptcha" escape="false"></ice:outputText>
I successfully find the outputText by id from Java code
UIViewRoot root = FacesContext.getCurrentInstance().getViewRoot();
HtmlOutputText icefacesOutputText = (HtmlOutputText) root
.findComponent("mainContentForm:txtCaptcha");
and put some html code in it so with Firebug I can view:
<span class="iceOutTxt" id="mainContentForm:txtCaptcha" style="height:300px; width:100%;"><script type="text/javascript" src="http://api.recaptcha.net/challenge?k=<key>"></script>
<noscript>
<iframe src="http://api.recaptcha.net/noscript?k=<key>" height="300" width="500" frameborder="0"></iframe><br>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="">
</noscript></span>
Well… I do not understand why it does NOT appear in the html page? Why I can only see the content with Firebug?
Thanks in advance
Here is another suggestion:
then in the getter of the bean
myBean, you return your HTML code:As you set the
escape="false"attribute, it will not escape the HTML characters, and thus it will be generated.