This content has been marked as final. Show 6 replies
You should pass the parameter like this:
Do not manipulate the page's URL directly.
<h:commandButton value="commandButton1" id="cb1" type="submit"> <f:param value="asd" name="test" id="test"/> </h:commandButton>
But I don't want to pass this param.
I want to obtain it from URL in java code (and I'm using it, that it is also displayed in JSF page)...
Edited by: 965647 on 2013-01-28 11:41
I know. But if you pass it the way I suggest, the Java code you already have should work.
Store the parameter in a view scope parameter and then access that parameter from Java code using EL.
Here is the basic part (without the java code):
If you have a parameter in URL named as "product", you can get its value like:
FacesContext facesContext = FacesContext.getCurrentInstance();
HttpServletRequest httpRequest =
String product = httpRequest.getParameter("product");
Blueberry Coder - it doesn't work.
SudhanshuG - it also doesn't work.
Shay Shmeltzer - your solution works.