0
我想生成JSF页面我有(我不是JSP,所以我不能使用的out.print)一些HTML代码,所以我用的ICEfaces分冰:的outputText:跨度生成html代码?
<ice:outputText id="txtCaptcha" escape="false"></ice:outputText>
我顺利地找到从Java代码
UIViewRoot root = FacesContext.getCurrentInstance().getViewRoot();
HtmlOutputText icefacesOutputText = (HtmlOutputText) root
.findComponent("mainContentForm:txtCaptcha");
通过ID的outputText,并把一些HTML代码,它因此与萤火虫,我可以查看:
<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>
嗯......我不明白为什么它没有一个ppear在html页面中?为什么我只能看到Firebug的内容?
在此先感谢
你(或IceFaces)在执行一些JavaScript/Ajax代码后插入HTML吗?这将解释为什么它不能在生成的HTML输出中使用,但只能在只有JavaScript(和Firebug)才能看到的HTML DOM树的当前状态下使用。 – BalusC 2011-03-02 14:04:34
你是对的BalusC。不知何故,Icefaces并没有为我的表单做一个完整的post-back,但“渲染发生在服务器端的DOM中,并且只有对DOM的增量更改才会传递到浏览器并使用轻量级的Ajax Bridge重新组合” – 2011-03-02 14:08:11