jsf取值的简单问题

07-11-07 ximinjie

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>

careprad
2008-07-24 18:01

request级别当然取不到值了,用session级