JSF 응용 프로그램을 개발 중입니다. 2 개의 selectOnemenu 컨트롤과 제출 버튼이 있습니다. 그래서 읽을 수 는 I 2 개 필드의 값 I는 AJAX로 onchange를 사용하려고값을 비교하는 방법 JSF selectonemenu
<h:selectOneMenu id="from" value="#{currencyBean.history.fromCurrency}" >
<f:selectItems value="#{currencyBean.currency}" var="c" itemValue="#{c}" itemLabel="#{c.name}"/>
</h:selectOneMenu>
<p:outputLabel for="to" value="to:" />
<h:selectOneMenu id="to" value="#{currencyBean.history.toCurrency}" >
<f:selectItems value="#{currencyBean.currency}" var="c" itemValue="#{c}" itemLabel="#{c.name}"/>
</h:selectOneMenu>
<p:commandButton id="calculateButton" value="Convert" update=":convert :historyPanel" onstart="PF('statusDialog').show()" onsuccess="PF('statusDialog').hide()" validateClient="true" ajax="true" action="#{currencyBean.Calculate()}" />
동일하지만 매번 I 번째 drowpdown의 값이 backbean에서 널되었다 한 드롭을 변경할 경우 버튼을 해제해야 그것. 여기
내 backbean
@Named(value = "currencyBean")
@RequestScoped
public class CurrencyBean implements Serializable {
/**
* Creates a new instance of CurrencyBean
*/
private History history;
private Currency currency;
private Date currentDate;
@Inject
private Loginbean loginBean;
private List<History> historyList;
public List<History> getHistoryList() {
int userId = loginBean.getUserId();
if (userId != -1) {
return new HistoryHelper().GetHistoryListByUser(userId);
}
return null;
}
public CurrencyBean() {
history = new History();
}
public History getHistory() {
return history;
}
public void setHistory(History history) {
this.history = history;
}
public Currency[] getCurrency() {
return Currency.values();
}
public Date getCurrentDate() {
return new Date();
}
public void Calculate() {
int userId = loginBean.getUserId();
if (userId != -1) {
new CurrencyClient().Convert(userId, this.history);
}
}
}
단서입니까?
더 정밀하게 입력하고 onchange 메서드를 구현하는 방법을 exatcly 입력 할 수 있습니까 ?? 그리고 백킹 빈과 같은 모습, 특히 그 범위는 –
내 백의를 추가하기 위해 내 질문을 업데이트했습니다. onchange 구현에 관한, 난 그냥 필드에서 값을 null로 필드를 업데이트하는 경우 로그 값을 모두에서 및 필드에 업데이트 할 시도했다 필드 값을 업데이트하는 경우 null –
그리고 어디에 이 onchange 구현 ?? selectOneMenu에서? onchange 속성에서 무엇이 불려지나요? –