【发布时间】:2014-02-03 01:00:39
【问题描述】:
我愿意调用这样的方法:
<h:commandButton value="Register" action="#{account.action}"/>
使用如下类:
package com.sources;
public class Account {
private String password1;
private String password2;
public String getPassword1() {
return password1;
}
public void setPassword1(final String password1) {
this.password1 = password1;
}
public String getPassword2() {
return password2;
}
public void setPassword2(final String password2) {
this.password2 = password2;
}
public void action() {
//if the passwords matchs
//change page
//else
//display an error on the xhtml page
}
}
在方法中,我想更改页面或显示错误,取决于注册的有效性。
改变页面的动作和下面的一样,但是在方法#{account.action}中调用:
<h:commandButton value="Register" action="connect"/>
【问题讨论】:
标签: java jsp jsf xhtml commandbutton