日期:2014-05-16  浏览次数:20398 次

JSF如何取得Request中的parameter

用户进入http://localhost:8080/test/active.jsf?username=xxx&activecode=yyy页面

?

?? active.jsp :

?

<h:form id="acctiveAccount_form"> 
  <h:inputText id="username" value="#{accountActiveBean.username}" required="true" maxlength="30"/ > 
  <h:inputText id="activecode" value="#{accountActiveBean.activecode}" required="true" maxlength="30"/ > 
  <h:inputSecret id="password" value="#{accountActiveBean.password}" required="true" maxlength="20"/ > 
  <h:commandButton id="submitButton" value="#{messages['button_submit']}" action="#{accountActiveBean.active}" /> 
</h:form> 

?

如何让username和activecode得到url中的参数"xxx","yyy"?

?

1. #{param.xxx},#{param.xxx}

?

2. 可以使用这个方法获得?
????FacesContext.getCurrentInstance().getExternalContext()
??? .getRequestParameterMap().get("...");