You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by sw...@datachest.com on 2002/03/20 18:24:24 UTC

Using a dynamic property inside a tag

I have the following code inside my action class.

            java.util.List al = fm.getFilesByUserName(conn,"SCOTT");
            request.setAttribute("files.count", new Integer(al.size()) );
            request.setAttribute("files.pageSize", new Integer(3) );
            request.setAttribute("userFiles", al );

Now in my JSP page I can do

<H1> Files per page is  <%= request.getAttribute("files.pageSize").toString
() %> </H1>

but when I try and use this value inside my logic iterate tag as below.

<logic:iterate id="element" name="userFiles" length="<%=
request.getAttribute("files.pageSize").toString() %>" >
  <tr class="highlight">
 .....

I get the following error.
org.apache.jasper.compiler.ParseException: /files.jsp(76,93) Attribute
files.pageSize has no value
             at
org.apache.jasper.compiler.JspReader.parseAttributeValue(JspReader.java:563)

             at
org.apache.jasper.compiler.JspReader.parseTagAttributes(JspReader.java:681)

Can someone point me in the right direction.

Searching the archives and looking on the internet didn't help me much as
that is where I got the code from.

Appologies if this is posted in HTML we are using Lotus Notes and I am not
sure how to subimt in plain text. (I miss outlook)

Thanks,
Scott.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Using a dynamic property inside a tag

Posted by Filipe Mateus <fi...@fbn.ca>.
You have to escape the quotes with backslash:

<logic:iterate id="element" name="userFiles" 
	length="<%=request.getAttribute(\"files.pageSize\").toString() %>" >

On Wed, 20 Mar 2002 12:24:24 -0500
swatson@datachest.com wrote:

> 
> I have the following code inside my action class.
> 
>             java.util.List al = fm.getFilesByUserName(conn,"SCOTT");
>             request.setAttribute("files.count", new Integer(al.size()) );
>             request.setAttribute("files.pageSize", new Integer(3) );
>             request.setAttribute("userFiles", al );
> 
> Now in my JSP page I can do
> 
> <H1> Files per page is  <%= request.getAttribute("files.pageSize").toString
> () %> </H1>
> 
> but when I try and use this value inside my logic iterate tag as below.
> 
> <logic:iterate id="element" name="userFiles" length="<%=
> request.getAttribute("files.pageSize").toString() %>" >
>   <tr class="highlight">
>  .....
> 
> I get the following error.
> org.apache.jasper.compiler.ParseException: /files.jsp(76,93) Attribute
> files.pageSize has no value
>              at
> org.apache.jasper.compiler.JspReader.parseAttributeValue(JspReader.java:563)
> 
>              at
> org.apache.jasper.compiler.JspReader.parseTagAttributes(JspReader.java:681)
> 
> Can someone point me in the right direction.
> 
> Searching the archives and looking on the internet didn't help me much as
> that is where I got the code from.
> 
> Appologies if this is posted in HTML we are using Lotus Notes and I am not
> sure how to subimt in plain text. (I miss outlook)
> 
> Thanks,
> Scott.
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


**********************************************************************
Financiere Banque Nationale et NBCN n'assument
aucune responsabilite quant a la confidentialite et l'integrite du
present courriel en raison des risques d'interception inherents 
a l'Internet. Pour cette raison, toute opinion exprimee au terme 
des presentes ne reflete pas necessairement celle de 
Financiere Banque Nationale et de NBCN.
**********************************************************************
Due to the security risks involved in sending information over the
Internet, National Bank Financial  and NBCN cannot be held responsible 
for ensuring the confidentiality and integrity of the present e-mail. For this 
reason, the opinions expressed herein do not necessarily reflect those of 
National Bank Financial and NBCN.
**********************************************************************


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>