【发布时间】:2011-12-24 09:41:59
【问题描述】:
我有一个非常复杂的 JSF 页面(我们使用带有 facelet 的 JSF2),我必须在其中“插入”一个纯 html 表单部分(它代表一个所见即所得的模板,用于稍后将创建为 Pdf 的文档)。 非常简化的页面看起来像
<h:form id="formEditDoc">
<p:commandButton styleClass="commandButton" value="Save"
actionListener="#{myBean.myAction}" update="masterForm:msg">
</p:commandButton>
<!-- some jsf controls here -->
....
<!-- this is my dynamic section -->
<input id="ft2" type="text" value="foo"/>
</h:form>
在托管 bean myBean(请求范围)中,我有一个动作侦听器,我尝试在其中以这种方式获取“foo”字符串:
String text1 = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("ft2");
但我无法获得价值。 Text1 始终为空。我什至尝试将 ajax=false 设置为 commandButton,但没有任何改变。 知道我做错了什么吗?
【问题讨论】: