Reputation: 16920
Can this method work?
public String sayHello(){
return "Hello.jsp?name=" + "laala";
}
I am unable to access, query string using the above method. I tried ${param.name} as well as request.getParameter("name"). They both return null. Please help!
Upvotes: 1
Views: 2428
Reputation: 2969
maybe this would help you. check out f:param with h:commandLink
http://balusc.blogspot.com/2006/06/communication-in-jsf.html
Upvotes: 2
Reputation: 1109745
Either fire a redirect..
public void sayHello(){
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
externalContext.redirect("/Hello.jsp?name=" + "laala");
}
.. or if you're already on JSF2, then just define them in navigation case:
<to-view-id>/Hello.jsp?name=#{bean.property}</to-view-id>
(although the .jsp
file extension less or more hints that you're not on JSF2 yet)
When using the JSF2 navigation case, if you want the new URL get reflected in the browser address bar, you need to add a <redirect/>
entry, else it will just do a forward.
Upvotes: 4