myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joshua White" <whitej...@telcordia.com>
Subject RE: Scope Between Request and Session
Date Tue, 04 Jan 2005 17:27:24 GMT
After the declarations, you could use <h:outputText value="#{customer.name}"/>. The value
binding would look to the Request map first to resolve "customer" and find the object put
there by the j:declare component.

-----Original Message-----
From: Joshua White 
Sent: Tuesday, January 04, 2005 12:00 PM
To: MyFaces Discussion
Subject: 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>

Mime
View raw message