Hi
How to read query string value via managed bean in jsf1.1
Hi
How to read query string value via managed bean in jsf1.1
String queryString = ((HttpServletRequest) FacesContext.getCurrentContext()
.getExternalContext().getRequest()).getQueryString();
Put this in the action method or a phase listener where you need it. Don't put it in constructor.
I am not sure how the answer of Bozho didn't work for you, but regardless of this, I would suggest to let JSF do all the work rather than getting the "raw" HttpServletRequest
from under the JSF hoods inside a bean. Make use of the JSF managed property facility.
First, add two properties to the bean: confirmuser
and emailid
, of course with getters and setters. Then, define them as managed properties in faces-config.xml
wherein they are to be filled with #{param.confirmuser}
and #{param.emailid}
. You probably already know, the #{param}
points to the request parameter map.
E.g.
<managed-bean>
<managed-bean-name>userManager</managed-bean-name>
<managed-bean-class>com.example.UserManager</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>confirmuser</property-name>
<value>#{param.confirmuser}</value>
</managed-property>
<managed-property>
<property-name>emailid</property-name>
<value>#{param.emailid}</value>
</managed-property>
</managed-bean>
This way JSF will automatically set the bean properties with those values.