jsf取值的簡單問題

ximinjie發表於2007-11-07
managedbean的範圍被設定成了request後,a頁面跳轉到b頁面後就不能取值了.請問要取值應該怎麼寫?
managedbean

public class UserManagedBean {

private String user;

private String password;

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public String getUser() {
return user;
}

public void setUser(String user) {
this.user = user;
}


public String login() {
return "ok";

}
}

a.jsp

<body>
<f:view>
<h:form>
姓名:<h:inputText value="#{user.user}" />
密碼:<h:inputText value="#{user.password}"/>
<h:commandButton value="確定" action="#{user.login}" />
</h:form>
</f:view>
</body>

b.jsp

<body>
<f:view>
密碼是<h:outputText value="#{user.password}" />
</f:view>
</body>

相關文章