【发布时间】:2014-02-15 08:07:41
【问题描述】:
对于熟悉 Primefaces 但我才刚刚开始的人来说,我的问题应该是微不足道的。我的问题是: 当我像这样将 inputText 组件放入我的网页时:
<h:form id="formularz">
<p:inputText id="workyears" value="#{appointentBean.year}" style="width: 40px;"/>
<h:form>
我想直接从appendentBean 中检索输入的文本。我的意思是我想在 AppendentBean 中创建另一个方法来处理输入的文本,所以我需要将输入的文本立即放在引用的字段 year 中。在另一个世界中,当有人将文本放入 inputText 组件时,我需要自动更新我在 AptentBean 中的字段年份。提交之类的?我希望你明白我的意思。
这是我的 managedBean:
@ManagedBean
@ViewScoped
@SessionScoped
public class appointentBean{
private int year;
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
//Here I will put another method that will be operate on year value
}
【问题讨论】:
-
my field year in appointentBean to be automaticaly updated while someone put text in inputText component是指与按键事件的 ajax 交互来调用您的方法? -
想直接检索输入的文本
--->你说的是这个自动完成吗?自动更新? -
是的,我将使用 commandButton 来调用我的方法
标签: ajax primefaces