【发布时间】:2014-04-26 09:38:19
【问题描述】:
我正在尝试做一些与Getting value from dynamically created inputText 非常相似的事情,我遇到了一些困难,这就是为什么我会在这里问我的问题,希望你能帮助我。我想将动态生成的输入框与对象绑定。我有:
<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>
在 filterTypeValue 的请求 bean 中我有:
private String filterTypeValue;
public String getFilterTypeValue() {
return filterTypeValue;
}
public void setFilterTypeValue(String filterTypeValue) {
this.filterTypeValue = filterTypeValue;
}
我的问题来自于我有三个实体 - TRequest、TRequestFilter、TFilter。 TRequestFilter 是一个映射表,其中我有 TREQUEST、TFILTER 和我想从后者的输入框中获取并插入 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 中设置输入框的值,因为首先我在数据库中插入一个新请求,然后我想在 TRequestFilter 表中插入这个新请求的过滤器(我需要 TFilter 和插入的值的原因为了它)。
非常感谢您的帮助!
【问题讨论】:
标签: java jsf primefaces