Java 从forEach节中动态创建的inputText框中获取值

Java 从forEach节中动态创建的inputText框中获取值,java,jsf,primefaces,Java,Jsf,Primefaces,我正在尝试做一些非常类似的事情,我有一些困难,这就是为什么我会在这里问我的问题,希望你能帮助我。我想用对象绑定动态生成的输入框。我有: <c:forEach items="${filterTypeBean.listTextFilterTypes()}" var="inputBoxes"> <h:outputText value="${inputBoxes.filterTypeName

我正在尝试做一些非常类似的事情,我有一些困难,这就是为什么我会在这里问我的问题,希望你能帮助我。我想用对象绑定动态生成的输入框。我有:

<c:forEach items="${filterTypeBean.listTextFilterTypes()}"
                        var="inputBoxes">
                        <h:outputText value="${inputBoxes.filterTypeName}"
                            style="width: 100px; white-space: normal; border: 3px" />
                        <h:inputText value="${requestBean.filterTypeValue}" />
                    </c:forEach>
我的问题来自于我有三个实体——TRequest、TRequestFilter和TFilter。TRequestFilter是一个映射表,其中有TREQUEST、TFILTER和要从inputbox获取并插入到DB中的值

filterTypeBean.listTextFilterTypes我从filterTypeBean获取:

public List<TFilterType> listTextFilterTypes() {
        EntityManager em = HibernateUtil.getEntityManager();
        Query q = em.createQuery("select u from TFilterType u where u.filterType like 'T'");
        List<TFilterType> resultList = q.getResultList();
        return resultList;
    }
我想在RequestBean中设置inputbox的值,因为首先我在DB中插入一个新请求,然后我想在TRequestFilter表中插入这个新请求的过滤器,我需要TFilter的原因和它的插入值


非常感谢你的帮助

我设法在我的bean类中使用映射:

private Map<TFilterType, Object> values = new HashMap<TFilterType, Object>();

public Map<TFilterType, Object> getValues() {
        return values;
    }
通过这种方式,我拥有和对象及其值,并且能够在数据库中的新实体中插入一条记录

private Map<TFilterType, Object> values = new HashMap<TFilterType, Object>();

public Map<TFilterType, Object> getValues() {
        return values;
    }
while (it.hasNext()) {
            Map.Entry pairs = (Map.Entry) it.next();
            if (pairs.getValue() != null) {
                          System.out.println(pairs.getKey() + '='+ pairs.getValue());
            }
            it.remove(); // avoids a ConcurrentModificationException
        }