I am using JSF 2.0 and Icefaces
and Glassfish
for my project and I want to optimise this application the best I can, and I want to know what is the most optimized method to send parameter.
first 1:
using /BackOffice/test.xhtml?id=7 in url
and String a=(String) FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get("id");
in the bean with @RequestScoped
and
<f:metadata>
<f:viewParam name="id" value="#{id}">
</f:viewParam>
</f:metadata>
in the jsf
or
the second :
using backing bean with @SessionScoped
If you want to optimize you should start with profiling, I highly doubt the difference between these two will be of any significance.
Request parameters should be passed as request parameters as you will otherwise break bookmarks, browser history, search engine indexing and caching.