You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@beehive.apache.org by Srini <k_...@yahoo.com> on 2005/03/07 02:50:56 UTC

Unable to retrieve values of the atrtibutes of pageContext

Hi ,
 
I am getting the following error on the browser when tried to display the values of the attributes of the PageContext.
 
I am getting the results alternatively by using netui-data:getData tag.

Exception: javax.servlet.jsp.el.ELException: Unable to find a value for "stateValue" in object of class "org.apache.jasper.runtime.PageContextImpl" using operator "." 
Here is my JSP
 
<netui-data:repeater dataSource="pageFlow.persons" defaultText="No Persons Found">
 <netui-data:repeaterHeader>
    <table border="1" cellpadding="6" cellspacing="1" width="100%">
    <tr valign="bottom">
        <td><b>First Name</b></td>
        <td><b>Last Name</b></td>
         <td><b>Phone</b></td>
        <td><b>E-mail</b></td>
        <td><b>State (using callPageFlow) </b></td>
<td><b>State (using callPageFlow) </b></td>

           
    </tr>
 </netui-data:repeaterHeader>
  <netui-data:repeaterItem>
 <tr>
    <td><b><netui:content value="${container.item.firstName}" /></b></td>
   <td><netui:content value="${container.item.lastName}" /></td>
   <td><netui:content value="${container.item.phone}" /></td>
   <td><netui:content value="${container.item.email}" /></td>
     
     <netui-data:callPageFlow  method="getStateName"  resultId="stateValue" object="apress.beehive.databinding.Controller">
      <netui-data:methodParameter value="${container.item.state}"/>
 </netui-data:callPageFlow>
 <td> 
<netui:content value="${pageContext.stateValue}"/> 
</td>

 <% String stateValue=((String)pageContext.getAttribute("stateValue"));  %>
   
  <td><%=stateValue%> </td>
 
  </tr>
  </netui-data:repeaterItem>
       <netui-data:repeaterFooter>
            </table>
        </netui-data:repeaterFooter> 
    </netui-data:repeater> 
 
I am using the latest version of the code.
Thanks
Srini
 


Re: Unable to retrieve values of the atrtibutes of pageContext

Posted by Eddie O'Neil <ek...@bea.com>.
Srini--

   In JSP 2.0, the "pageContext" is used to refer to the class 
"javax.servlet.jsp.PageContext" as a JavaBean.  In order to data bind to 
the attributes that are in the PageContext's attribute map, try using 
the "pageScope" implicit object.

   So, your expression would become:

   ${pageScope.stateValue}

Hope that helps.

Eddie



Srini wrote:
> Hi ,
>  
> I am getting the following error on the browser when tried to display the values of the attributes of the PageContext.
>  
> I am getting the results alternatively by using netui-data:getData tag.
> 
> Exception: javax.servlet.jsp.el.ELException: Unable to find a value for "stateValue" in object of class "org.apache.jasper.runtime.PageContextImpl" using operator "." 
> Here is my JSP
>  
> <netui-data:repeater dataSource="pageFlow.persons" defaultText="No Persons Found">
>  <netui-data:repeaterHeader>
>     <table border="1" cellpadding="6" cellspacing="1" width="100%">
>     <tr valign="bottom">
>         <td><b>First Name</b></td>
>         <td><b>Last Name</b></td>
>          <td><b>Phone</b></td>
>         <td><b>E-mail</b></td>
>         <td><b>State (using callPageFlow) </b></td>
> <td><b>State (using callPageFlow) </b></td>
> 
>            
>     </tr>
>  </netui-data:repeaterHeader>
>   <netui-data:repeaterItem>
>  <tr>
>     <td><b><netui:content value="${container.item.firstName}" /></b></td>
>    <td><netui:content value="${container.item.lastName}" /></td>
>    <td><netui:content value="${container.item.phone}" /></td>
>    <td><netui:content value="${container.item.email}" /></td>
>      
>      <netui-data:callPageFlow  method="getStateName"  resultId="stateValue" object="apress.beehive.databinding.Controller">
>       <netui-data:methodParameter value="${container.item.state}"/>
>  </netui-data:callPageFlow>
>  <td> 
> <netui:content value="${pageContext.stateValue}"/> 
> </td>
> 
>  <% String stateValue=((String)pageContext.getAttribute("stateValue"));  %>
>    
>   <td><%=stateValue%> </td>
>  
>   </tr>
>   </netui-data:repeaterItem>
>        <netui-data:repeaterFooter>
>             </table>
>         </netui-data:repeaterFooter> 
>     </netui-data:repeater> 
>  
> I am using the latest version of the code.
> Thanks
> Srini
>  
> 
>