FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext = facesContext.getExternalContext();
Map requestParameterMap = externalContext.getRequestParameterMap();
Iterator parameterNames = externalContext.getRequestParameterNames();
String parameterValue ="";
String parameterName="";
StringBuilder urls = new StringBuilder();
String url=externalContext.getRequestPathInfo();
int i=0;
if(null!=url){
urls.append(url);
while (parameterNames.hasNext()) {
parameterName = (String) parameterNames.next();
if(parameterName.equals("enterpriseId")){
parameterValue = (String) requestParameterMap.get(parameterName);
if(i==0){
urls.append("?");
}else{
urls.append("&");
}
urls.append("enterpriseId="+parameterValue);
i++;
//break;
}
/**有其他参数在依次添加*/
if(parameterName.equals("productId")){
parameterValue = (String) requestParameterMap.get(parameterName);
if(i==0){
urls.append("?");
}else{
urls.append("&");
}
urls.append("productId="+parameterValue);
i++;
//break;
}
}
}
System.out.println("FacesContext.getCurrentInstance().getExternalContext().getRequestPathInfo()="+urls.toString());
LoginUserSession.getInstance().saveStrSessionBean(EnSystemConfig.EN_CURRENT_URL, urls.toString());
return "/pages/member/loginn.xhtml?faces-redirect=true";
JSF获取页面路径和参数
最新推荐文章于 2022-07-28 11:48:19 发布