File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes JSF - passing <f:param> from JSF to Backing Bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF - passing <f:param> from JSF to Backing Bean" Watch "JSF - passing <f:param> from JSF to Backing Bean" New topic

JSF - passing <f:param> from JSF to Backing Bean

Zahoor Haque

Joined: Mar 16, 2011
Posts: 4
Hi Experts,
I m new to JSF and I would like to know that the parameter that iam passing from JSF <f:param> tag. and retieving the same within a bean using facesContex.getRequestParameterMap().get("paramName")

is the right method to do it.
and also the value that is been checked in the checkbox should pass to the bean. and in bean in doing Map.get(value from jsf)
please take a look on the code.


<tr:column width="16%">
<f:facet name="header">
<hutputText value="Prompt Name" styleClass="tableHeader_txt"/>
<h:selectBooleanCheckbox id ="chkbox2" valueChangeListener="#{preferenceBean.setNewListValues}" onchange="this.form.submit()">
<tr:forEach var="pName" items="#{preferenceBean.newListNames}">
<f:selectItem itemLabel="#{pName}" itemValue="#{pName}" />
<f:param name="keyFromJSF" value="#{pName}" />
<!--<f:setPropertyActionListener target="#{preferenceBean.keyFromJSF}" value="#{pName}" />-->

<tr:column width="16%">
<f:facet name="header">
<trutputText value="Prompt Value" styleClass="tableHeader_txt" />
<h:selectManyListbox value="#{preferenceBean.selectedPromptValues}">
<tr:forEach var="pValue" items="#{preferenceBean.newListValues}">
<f:selectItem itemLabel="#{pValue}" itemValue="#{pValue}" />

The parameter that iam passing from checkbox based on that iam trying to getvalues from the map. and display new values in the selectManyListBox for every checkBox selection.


public void setNewListValues(javax.faces.event.ValueChangeEvent event) {

setCheckBoxSelect((Boolean) event.getNewValue());

if(isCheckBoxSelect()!= false)
FacesContext context = FacesContext.getCurrentInstance();
keyFromJSF = context.getExternalContext().getRequestParameterMap().get("keyFromJSF");
newListValues = new ArrayList<String>(StoreMap.get(keyFromJSF));
System.out.println(" After Passing Param (SETTER): " + newListValues);
newListValues = new ArrayList<String>();

Do i have to set the property in the faces-config.xml ?



Do i have to uncomment the <managed-property> faces-config.xml
Brendan Healey
Ranch Hand

Joined: May 12, 2009
Posts: 218

Hi, check out this excellent resource here:,
and good luck with it.

I agree. Here's the link:
subject: JSF - passing <f:param> from JSF to Backing Bean
It's not a secret anymore!