用户进入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("...");
本文介绍如何在JSF页面中通过username和activecode字段获取URL中的参数值。具体实现方式包括使用EL表达式直接获取或者利用FacesContext对象的getRequestParameterMap方法。
328

被折叠的 条评论
为什么被折叠?



