Monday, February 12, 2007
How to use URL to pass parameter to JSF page?
If you have this page:
URL: http://your_server/your_app/product.jsf?id=777
You can use the following code to get the value from back-bean:
FacesContext fc = FacesContext.getCurrentInstance();
String id = (String) fc.getExternalContext().getRequestParameterMap().get("id");
you also can use some pre-define viriable to get the same value from JSF page.
h:outputText value="#{param['id']}"
Note: you must invoke this jsf page directly, you also should use servlet mapping.
URL: http://your_server/your_app/product.jsf?id=777
You can use the following code to get the value from back-bean:
FacesContext fc = FacesContext.getCurrentInstance();
String id = (String) fc.getExternalContext().getRequestParameterMap().get("id");
you also can use some pre-define viriable to get the same value from JSF page.
Note: you must invoke this jsf page directly, you also should use servlet mapping.
Comments:
<< Home
Not sure if this helps, but I realized that you could also embed arbitrary JSP in your JSF. See my post at http://communitygrids.blogspot.com/2006/12/more-jsp-hacking-in-jsf.html
Post a Comment
<< Home