隐藏字段值为空
问题描述:
我试图在请求范围中设置隐藏字段值来支持bean,但我发现setter的值是空的“”,尽管客户端有一个值(可以在firebug中看到)。在调用actionListener
之前,setter被调用,但plan的参数为空。隐藏字段值为空
<managed-bean>
<managed-bean-name>carController</managed-bean-name>
<managed-bean-class>com.domain.myproject.controller.CarController</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>plan</property-name>
<value>#{param.planUI}</value>
</managed-property>
</managed-bean>
public class CarController {
private String plan = "";
// getter and setter
}
main.xhtml
<h:form id="myForm">
<input type="hidden" name="planUI" id="planUI" value=""/>
....
<ice:panelGroup>
<ice:menuPopup id="popupmenu">
<ice:menuItem id="item1" value="item" immediate="true"
onclick="document.getElementById("myForm:planUI").Value = 'test';"
actionListener="#{someBean.listener}">
</ice:menuItem>
</ice:menuPopup>
</ice:panelGroup>
答
没有与该方法的问题,你在呼唤只是改变你的onlclick
到以下。
onclick="document.getElementById('myForm:planUI').value = 'test';"
你应该使用双引号及使用小v与v ALUE
我想我将不得不使用cookie里面的单引号。 –