jsf - parameter in URL jsf2 -
I need this link:
To remove from the id A code like this:
HTTP request request request = (HTTPSERT request) Facsontax. Gate Current Instance () GetExternalContext (). GetRequest (); String clip id = request.getParameter ("id");
When I run it on Tomcat, I get:
Message / Owner / Pager / clip.jsf Embedded = 9099
The details requested resource (/OnAir/innerpage/clip.jsf&id=9099) is not available.
When I call it & amp; If id runs without id 9099 then it runs fine.
How can I run it?
Is the separator character url between path and query string ?
, No & amp;
& amp; for multiple parameters in the query string;
is the separator character, e.g. name1 = Value1 & amp; NAME2 = 2 value & amp; NAME3 = value3
. If you ?
, the query string will be seen as part of the path in the URL, so you will not get an HTTP 404 page / resource, as you came across.
Therefore, this link should work
He said, there is a better way to reach the request parameter. Set it as a managed asset with the value of # {param.id}
.
public class bean {@ManagedProperty (value = "# {param.id}") Private Long ID; @PostConstruct Public Zero init () {System.out.println (id); // 9099 as your example} // ...}
EL # {param.id}
you request.getParameter ("id ")
.
A tip: Whenever you have to cover "raw" service ATP under JSF hood inside the managed Bean, always ask yourself (or here): "There is no JSF-IIS way?". There is a big chance that you are completing things unnecessarily;)
Comments
Post a Comment