我正在使用包含页面,并希望将对象的ID从主页面传递到包含页面的后端。
我试过这个
<ui:include src="/fleetreport/vehicledocument_list.xhtml">
<ui:param name="fleetvehicleid" value="#{contractDetail.contract.fleetVehicleId}"/>
</ui:include>
在vehicledocument_list.xhtml的支持中
Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
if (params.get("fleetvehicleid") != null) {
fleetVehicleId = new Integer(params.get("fleetvehicleid"));
}
但是params.get(&#34; fleetvehicleid&#34;)始终为空。
有没有办法将这个id参数传递给bean?
答案 0 :(得分:1)
FaceletContext faceletContext = (FaceletContext) FacesContext.getCurrentInstance().getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
Object p1 = faceletContext.getAttribute("fleetvehicleid");
看起来类似的问题 How to retrieve value of a ui:param in the backing bean