首页 > 解决方案 > Bean 不取值

问题描述

我有以下问题。

这是 JSF 模板客户端:

<h:selectOneRadio value="#{booking.actividad}"
                                  layout="pageDirection">
                    <f:selectItems value="#{actividadesClientBean.actividadesByFechaMayor}"
                                   var="m"
                                   itemValue="#{m.id}"
                                   itemLabel="#{m.nombre}"/>
 </h:selectOneRadio>

value标签 on h:selectIneRadio应该将 in 变量保存在selectedItembookingactividad StringBean。但是当被选中时,什么也没有发生。它节省了null......项目被正确渲染,所有与用户界面有关的事情都是正确的。我一直在寻找错误四个小时,一无所获。希望您能够帮助我。谢谢!

豆子代码:

@Named
@FlowScoped("booking")
public class Booking implements Serializable {


    @PersistenceContext
    private EntityManager em;
    private double precioC = new Double(0);
    private String tarjeta = "";
    private String actividad;

    public String getActividad() {
        return actividad;
    }

    public void setActividad(String actividad) {
        this.actividad = actividad;
    }
    .......
    .......
    More code

这是我第一次使用faces-flow. 这可能与它有关。但我不太确定。这是我的流程图:

<faces-config version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
    <flow-definition id="booking">
        <flow-return id="goHome">
            <from-outcome>/users/privatepage</from-outcome>
        </flow-return>
    </flow-definition>
</faces-config>

标签: jsf

解决方案


推荐阅读