SHARE
TWEET

open detail view with request parameter

a guest Feb 27th, 2012 20 Never
  1. <h:outputLink value="reqscope.faces">
  2.                 <f:param name="id" value="#{row.id}" />
  3.                 <h:outputText value="link" />
  4.         </h:outputLink>
  5.        
  6. <f:view>
  7.         id= <h:outputText value="#{param['id']}" />
  8.         <br />
  9.         id= <h:outputText value="#{lookupBean.id}" />
  10. </f:view>
  11.        
  12. public class LookupBean implements Serializable {
  13.  
  14.     public String getId() {
  15.         FacesContext context = FacesContext.getCurrentInstance();
  16.         ExternalContext extContext = context.getExternalContext();
  17.         Map<String, String> params = extContext.getRequestParameterMap();
  18.         return params.get("id");
  19.     }
  20.  
  21. }
  22.        
  23. <managed-bean>
  24.         <managed-bean-name>lookupBean</managed-bean-name>
  25.         <managed-bean-class>reqscope.LookupBean</managed-bean-class>
  26.         <managed-bean-scope>request</managed-bean-scope>
  27. </managed-bean>
  28.        
  29. <a4j:commandLink action="#{detailviewBean.setDetailID(entity.someid)}" value="#{entity.someid}" oncomplete="document.location='/app/detailview.seam'"/>
  30.        
  31. <h:commandLink action="#{reqscope.faces}">
  32.     <h:outputText value="link"/>
  33.     <f:setPropertyActionListener
  34.         value="#{id}"
  35.         target="#{lookupBean.id}"/>
  36. </h:commandLink>
RAW Paste Data
Top