Forums de discussion
Best way to pass parameter to JSF
Alexey Truntov, modifié il y a 12 années.
Best way to pass parameter to JSF
New Member Publications: 22 Date d'inscription: 15/07/11 Publications récentes
HI.
We want to use one parametrized xhtml for multiple portlets, could anyone please tell me what is the best way to pass parameter from portlet definition (portlet.xml) to JSF page?
We want to use one parametrized xhtml for multiple portlets, could anyone please tell me what is the best way to pass parameter from portlet definition (portlet.xml) to JSF page?
PortletFaces Community Member, modifié il y a 12 années.
RE: Best way to pass parameter to JSF
Regular Member Publications: 199 Date d'inscription: 03/04/12 Publications récentes
Hi Alexey
I read the parameters as normal into local variables in my model bean, then bind them to the form.
Check the examples both here and in www.icefaces.org, I think there is a worked example
You might prefer to put these into a view, session or other managed bean
Chris
ModelBean
then in my form
then in my backing bean
I read the parameters as normal into local variables in my model bean, then bind them to the form.
Check the examples both here and in www.icefaces.org, I think there is a worked example
You might prefer to put these into a view, session or other managed bean
Chris
ModelBean
@ManagedBean(name = "myModelBean")
@ViewScoped
private String myParamValue = liferayFacesContext.getPortletConfig().getInitParameter("myInitParameter");
public String getMyParamValue() {
return paramValue;
}
public void setParamValue(String val) {
paramValue = val;
}
then in my form
<aui-cc:input label="#{i18n['MyParameter']}" value="#{myModelBean.myParamValue}" />
then in my backing bean
// Injections
@ManagedProperty(value = "#{myModelBean}")
private transient MyModelBean myModelBean;
.... myModelBean.getParamValue();
etc
Alexey Truntov, modifié il y a 12 années.
RE: Best way to pass parameter to JSF
New Member Publications: 22 Date d'inscription: 15/07/11 Publications récentes
Thanks, Chris, we've found simple way - passing parameters via portlet-preferences.