Foros de discusión
How to read portlet init parameters
Vijaya Kumar Mukthala, modificado hace 11 años.
How to read portlet init parameters
New Member Mensajes: 16 Fecha de incorporación: 13/09/12 Mensajes recientes
Hi All,
I have defined the some init params in portlet.xml i would like to read init params based on the param name in the JSF managed bean.
I am orking on JSF portlet with liferay 6.1
Please find below i the sample code i defined init params in portlet.xml
<init-param>
<name>hpam-cilist-service-soap-action</name>
<value>http://tempuri.org/AmGmoGetList</value>
</init-param>
<init-param>
<name>hpam-cilist-input-file-name</name>
<value>GSP_List_Main_CI.xml</value>
</init-param>
these init params i want to read in JSF managed bean init() method.
Could you please help me how can i read these values.
Thank and Regads
Vijay
I have defined the some init params in portlet.xml i would like to read init params based on the param name in the JSF managed bean.
I am orking on JSF portlet with liferay 6.1
Please find below i the sample code i defined init params in portlet.xml
<init-param>
<name>hpam-cilist-service-soap-action</name>
<value>http://tempuri.org/AmGmoGetList</value>
</init-param>
<init-param>
<name>hpam-cilist-input-file-name</name>
<value>GSP_List_Main_CI.xml</value>
</init-param>
these init params i want to read in JSF managed bean init() method.
Could you please help me how can i read these values.
Thank and Regads
Vijay
David H Nebinger, modificado hace 11 años.
RE: How to read portlet init parameters
Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
Init params are available via the PortletContext. PortletContext is available via FacesContext using the getExternalContext() method.
Vijaya Kumar Mukthala, modificado hace 11 años.
RE: How to read portlet init parameters
New Member Mensajes: 16 Fecha de incorporación: 13/09/12 Mensajes recientes
Hello,
I am using the following code for reading the portlet init-param from the portlet.xml
final FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext != null) {
ExternalContext externalContext = facesContext.getExternalContext();
PortletContext portletContext = (PortletContext) externalContext.getContext();
LOGGER.info("Fetching the portlet init params {0}");
soapAction = portletContext.getInitParameter(Constants.CI_DETAIL_SOAP_ACTION);
inputFileName = portletContext.getInitParameter(Constants.CI_DETAIL_INPUT_FILE_NAME);
}
but i am not getting the param values.
Could u please help me about this.
Thanks in advance.
I am using the following code for reading the portlet init-param from the portlet.xml
final FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext != null) {
ExternalContext externalContext = facesContext.getExternalContext();
PortletContext portletContext = (PortletContext) externalContext.getContext();
LOGGER.info("Fetching the portlet init params {0}");
soapAction = portletContext.getInitParameter(Constants.CI_DETAIL_SOAP_ACTION);
inputFileName = portletContext.getInitParameter(Constants.CI_DETAIL_INPUT_FILE_NAME);
}
but i am not getting the param values.
Could u please help me about this.
Thanks in advance.