You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Joshua White <wh...@telcordia.com> on 2005/01/04 17:59:32 UTC

Scope Between Request and Session

If you think of your JSF document as a class, the Request parameters are like arguments to a method and the Session variables are like class variables. In the current design, we don't have *instance* variables. To solve this problem, I created a JSF component that holds a named value and makes it available to EL-expressions by putting it in the Request map.

ie. 
    <!-- Create a new Customer on the page -->
    <j:declare var="customer" type="com.mycompany.Customer"/> 
  
    <!-- Create a new Customer variable and assign a value to it -->    
    <j:declare var="customer" type="com.mycompany.Customer" value="#{expression that evaluates to a com.mycompany.Customer}"/> 
   
    <!-- Create a new Customer and call setName on it with the value of the specified expression -->
    <j:declare var="customer" type="com.mycompany.Customer">
        <f:param name="name" value="#{expression that evaluates to a String}"/>
    </j:declare>

    <!-- Create a new Customer variable, assign a value to it and call setName on it with the value of the specified expression -->
    <j:declare var="customer" type="com.mycompany.Customer" value="#{expression that evaluates to a com.mycompany.Customer}">
        <f:param name="name" value="#{expression that evaluates to a String}"/>
    </j:declare>