Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

open detail view with request parameter

By: a guest on Feb 27th, 2012  |  syntax: None  |  size: 1.09 KB  |  views: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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>