0

I'm using a include page and want to pass an ID of an object from the main page to the backingbean of the include page.

I tried like this

<ui:include src="/fleetreport/vehicledocument_list.xhtml">                      
    <ui:param name="fleetvehicleid" value="#{contractDetail.contract.fleetVehicleId}"/>
</ui:include>

And in the backingbean of vehicledocument_list.xhtml

Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
if (params.get("fleetvehicleid") != null) {
    fleetVehicleId = new Integer(params.get("fleetvehicleid"));
} 

But params.get("fleetvehicleid") is always null.

Is there a way to pass this id parameter to the bean?

roel
  • 2,005
  • 3
  • 26
  • 41
  • possible duplicate of [How to retrieve value of a ui:param in the backing bean](http://stackoverflow.com/questions/14459854/how-to-retrieve-value-of-a-uiparam-in-the-backing-bean) – Seitaridis Sep 15 '14 at 16:28

1 Answers1

1
FaceletContext faceletContext = (FaceletContext) FacesContext.getCurrentInstance().getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
Object p1 = faceletContext.getAttribute("fleetvehicleid");

Look similar question How to retrieve value of a ui:param in the backing bean

Community
  • 1
  • 1
Alexey Semenyuk
  • 3,263
  • 2
  • 32
  • 36