Reputation: 968
I can get the URL or URI just fine. However, JSF seems to exclude any URL parameters. For example:
Suppose the url is: www.example.com/pleasework?param=1
import javax.servlet.http.HttpServletRequest;
public String getUrl() {
HttpServletRequest request = (HttpServletRequest)
FacesContext.getCurrentInstance().getExternalContext().getRequest();
String url = request.getRequestURL().toString();
String uri = request.getRequestURI();
return uri;
}
My result is everything up until the ?
but I need everything after the ?
How can I accomplish this in JSF
Note: I need to get the URL server side so using Javascript's window.location.href
and storing value in hidden field is not a solution for me because I need the parameters on page load.
Upvotes: 1
Views: 1491
Reputation: 51030
Try the getParameterMap()
method on the request
object. Or you can also use the getParameter(parmName)
method.
Upvotes: 2