Jsf 如何使用cycle<;从列表映射元素;c:forEach>;使用来自<;h:输入文本>;

Jsf 如何使用cycle<;从列表映射元素;c:forEach>;使用来自<;h:输入文本>;,jsf,primefaces,Jsf,Primefaces,我是这些技术的新手,我需要帮助。 我尝试循环浏览列表中的所有元素,并为每个元素设置inputText框。我成功地循环了它们(UI看起来不错),但我很难编写Java代码,用inputText框中的值映射每个项目。我需要这个,因为我将不得不保存在数据库中的其他对象的id,输入值和其他一些东西,提前感谢您的帮助 以下是.xhtml文件中的代码: <h:panelGrid id="panel2" columns="2" cellpadding="5">

我是这些技术的新手,我需要帮助。 我尝试循环浏览列表中的所有元素,并为每个元素设置inputText框。我成功地循环了它们(UI看起来不错),但我很难编写Java代码,用inputText框中的值映射每个项目。我需要这个,因为我将不得不保存在数据库中的其他对象的id,输入值和其他一些东西,提前感谢您的帮助

以下是.xhtml文件中的代码:

<h:panelGrid id="panel2" columns="2" cellpadding="5">
                    <c:forEach items="${filterTypeBean.listTextFilterTypes()}"
                        var="inputBoxes">
                        <h:outputText value="${inputBoxes.filterTypeName}"
                            style="width: 100px; white-space: normal; border: 3px" />
                        <h:inputText value="??????????" />
                    </c:forEach>

托管bean代码:

 @ManagedBean(name = "filterTypeBean")
    @SessionScoped
    public class FilterTypeBean implements Serializable {

    // .....

    public TFilterType gettFilterType() {
        return tFilterType;
    }

    public void settFilterType(TFilterType tFilterType) {
        this.tFilterType = tFilterType;
    }

   //..


public List<TFilterType> listTextFilterTypes() {
            EntityManager em = HibernateUtil.getEntityManager();
            Query q = em.createQuery("select u from FilterType");
            List<TFilterType> resultList = q.getResultList();
            return resultList;
        }

        // I don't have the part with the mapping...

    }
@ManagedBean(name=“filterTypeBean”)
@会议范围
公共类FilterTypeBean实现可序列化{
// .....
公共TFilterType getFilterType(){
返回tFilterType;
}
公共无效settFilterType(TFilterType TFilterType){
this.tFilterType=tFilterType;
}
//..
公共列表listTextFilterTypes(){
EntityManager em=HibernateUtil.getEntityManager();
Query q=em.createQuery(“从FilterType中选择u”);
List resultList=q.getResultList();
返回结果列表;
}
//我没有映射的部分。。。
}

“@ManagedBean(name=“filterTypeBean”)@SessionScoped公共类filterTypeBean实现可序列化的{…..公共列表listTextFilterTypes(){EntityManager em=HibernateUtil.getEntityManager();Query q=em.createQuery(“从FilterType中选择u”);List resultList=q.getResultList();return resultList;}'我没有映射的部分…关于的方法应该是什么样子以及如何获取InputBox的映射ID(InputBox.ID)有什么想法吗以及插入的值,并将它们插入数据库中的新表中?提前感谢!是的,我有getter和setter方法,我也在上面添加了它们,感谢编辑。