package com.salpe.util;
import javax.faces.context.FacesContext;
public class FacesUtil{
/** * @param key
* @return */
public static Object getRequestParameter(String key) {
return FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get(key);
}
/** * @param key
* @param value */
public static void setRequestParameter(String key, Object value) {
FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put(key, value);
}
}
Then in any backing bean :
package com.salpe.authentication.managedbeans;
import com.salpe.util;
public class LoginPageBean {
LoginPageBean (){
}
// Action button for submit on login page
public actionSubmit(){
// Do anything logical
FacesUtil.setParameter("backPage" , "FromLoginPage")
return "welcomePage" ;
}
}
package com.salpe.managedbeans;
import com.salpe.util;
public class WelcomeBean{
WelcomeBean(){
String fromPage = FacesUtil.getParameter("backPage")
System.out.println( " Came from " + fromPage );
}
}
No comments:
Post a Comment