【问题标题】:Hidden Field value empty隐藏字段值为空
【发布时间】:2013-09-03 17:41:47
【问题描述】:

我正在尝试将隐藏字段值设置为请求范围内的支持 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
}

ma​​in.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>

【问题讨论】:

  • 我想我必须使用 cookie。

标签: jsf-2 icefaces icefaces-3


【解决方案1】:

您调用的方法有问题,只需将您的onclick 更改为关注即可。

onclick="document.getElementById('myForm:planUI').value = 'test';"

你应该在双引号中使用单引号,并且使用小的 vvalue

【讨论】:

    猜你喜欢
    • 2014-11-06
    • 1970-01-01
    • 2013-10-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-06
    相关资源
    最近更新 更多