You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Jiang, Jane (NIH/NCI) [C]" <ji...@mail.nih.gov> on 2007/11/21 16:50:14 UTC

[S2] s:if in 2.0.11

I am upgrading to 2.0.11 from 2.0.9 and got this error

SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /jsp/content/findAcrResults.jsp(6,0)
According to TLD or attribute directive in tag file, attribute test does
not accept any expressions

for this line in my jsp

<s:if test="${resultSize} > 0">

I changed it to 
<s:if test="%{resultSize>0}" >
Now the error went away.  But the statement never evaluated true.  I
took out the s:if statement, the result showed up corrected.  resultSize
is a request attribute.

Please advice,

Jane



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: [S2] s:if in 2.0.11

Posted by Martin Gainty <mg...@hotmail.com>.
pls display import statement and tld for expression you are usingMartin ______________________________________________Disclaimer and confidentiality noteEverything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.> Subject: [S2] s:if in 2.0.11> Date: Wed, 21 Nov 2007 10:50:14 -0500> From: jiangja@mail.nih.gov> To: user@struts.apache.org> > I am upgrading to 2.0.11 from 2.0.9 and got this error> > SEVERE: Servlet.service() for servlet jsp threw exception> org.apache.jasper.JasperException: /jsp/content/findAcrResults.jsp(6,0)> According to TLD or attribute directive in tag file, attribute test does> not accept any expressions> > for this line in my jsp> > <s:if test="${resultSize} > 0">> > I changed it to > <s:if test="%{resultSize>0}" >> Now the error went away. But the statement never evaluated true. I> took out the s:if statement, the result showed up corrected. resultSize> is a request attribute.> > Please advice,> > Jane> > > > ---------------------------------------------------------------------> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org> For additional commands, e-mail: user-help@struts.apache.org> 
_________________________________________________________________
Put your friends on the big screen with Windows Vista® + Windows Live™.
http://www.microsoft.com/windows/shop/specialoffers.mspx?ocid=TXT_TAGLM_CPC_MediaCtr_bigscreen_102007

RE: [S2] s:if in 2.0.11

Posted by "Jiang, Jane (NIH/NCI) [C]" <ji...@mail.nih.gov>.
I changed 
  <s:checkbox name="selectedItems" fieldValue="${acr.id}"
value="itemsSelected[${acr_rowNum}-1]" />

to 

  <s:checkbox name="selectedItems" fieldValue="%{#acr.id}"
value="%{itemsSelected[#acr_rowNum -1]}" />

I assume acr should be in pageContext.  Now I am having no error but the
value is not populated.  What did I do wrong?

Thanks,

Jane

-----Original Message-----
From: Jiang, Jane (NIH/NCI) [C] 
Sent: Wednesday, November 21, 2007 12:23 PM
To: Struts Users Mailing List
Subject: RE: [S2] s:if in 2.0.11

Thanks so much for your explanation.  I changed my statement to  
<s:if test="%{#request.resultSize>0}" >

That works.  I don't want to move result size to value stack yet since I
need to move on and see what other problems might exist for the upgrade.

Now I got a similar problem.  My result is displayed in a displaytag
table.

<display:table name="acrs" class="its" id="acr" pagesize="${pageSize}"
report="true" ..

One of the column is a checkbox.  
<display:column>
  <s:checkbox name="selectedItems" fieldValue="${acr.id}"
value="itemsSelected[${acr_rowNum}-1]" />
</display:column>

I got this error
org.apache.jasper.JasperException: /jsp/content/findAcrResults.jsp(17,2)
According to TLD or attribute directive in tag file, attribute
fieldValue does not accept any expressions

How can I get the value of acr.id?

Thanks,

Jane

-----Original Message-----
From: Dave Newton [mailto:newton.dave@yahoo.com] 
Sent: Wednesday, November 21, 2007 11:06 AM
To: Struts Users Mailing List
Subject: Re: [S2] s:if in 2.0.11

You're trying to mix expression languages.

%{resultSize > 0} assumes that resultSize is on the
value stack, most likely exposed via a public getter
on your action. This is arguably a better practice
anyway.

If the list itself is available on the stack then you
can call the size() method on the list in your <s:if
test="..."> OGNL expression and do away with the
request attribute altogether, which is arguably
cleaner anyway.

d.

--- "Jiang, Jane (NIH/NCI) [C]" <ji...@mail.nih.gov>
wrote:

> I am upgrading to 2.0.11 from 2.0.9 and got this
> error
> 
> SEVERE: Servlet.service() for servlet jsp threw
> exception
> org.apache.jasper.JasperException:
> /jsp/content/findAcrResults.jsp(6,0)
> According to TLD or attribute directive in tag file,
> attribute test does
> not accept any expressions
> 
> for this line in my jsp
> 
> <s:if test="${resultSize} > 0">
> 
> I changed it to 
> <s:if test="%{resultSize>0}" >
> Now the error went away.  But the statement never
> evaluated true.  I
> took out the s:if statement, the result showed up
> corrected.  resultSize
> is a request attribute.
> 
> Please advice,
> 
> Jane
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: [S2] s:if in 2.0.11

Posted by "Jiang, Jane (NIH/NCI) [C]" <ji...@mail.nih.gov>.
Thanks so much for your explanation.  I changed my statement to  
<s:if test="%{#request.resultSize>0}" >

That works.  I don't want to move result size to value stack yet since I
need to move on and see what other problems might exist for the upgrade.

Now I got a similar problem.  My result is displayed in a displaytag
table.

<display:table name="acrs" class="its" id="acr" pagesize="${pageSize}"
report="true" ..

One of the column is a checkbox.  
<display:column>
  <s:checkbox name="selectedItems" fieldValue="${acr.id}"
value="itemsSelected[${acr_rowNum}-1]" />
</display:column>

I got this error
org.apache.jasper.JasperException: /jsp/content/findAcrResults.jsp(17,2)
According to TLD or attribute directive in tag file, attribute
fieldValue does not accept any expressions

How can I get the value of acr.id?

Thanks,

Jane

-----Original Message-----
From: Dave Newton [mailto:newton.dave@yahoo.com] 
Sent: Wednesday, November 21, 2007 11:06 AM
To: Struts Users Mailing List
Subject: Re: [S2] s:if in 2.0.11

You're trying to mix expression languages.

%{resultSize > 0} assumes that resultSize is on the
value stack, most likely exposed via a public getter
on your action. This is arguably a better practice
anyway.

If the list itself is available on the stack then you
can call the size() method on the list in your <s:if
test="..."> OGNL expression and do away with the
request attribute altogether, which is arguably
cleaner anyway.

d.

--- "Jiang, Jane (NIH/NCI) [C]" <ji...@mail.nih.gov>
wrote:

> I am upgrading to 2.0.11 from 2.0.9 and got this
> error
> 
> SEVERE: Servlet.service() for servlet jsp threw
> exception
> org.apache.jasper.JasperException:
> /jsp/content/findAcrResults.jsp(6,0)
> According to TLD or attribute directive in tag file,
> attribute test does
> not accept any expressions
> 
> for this line in my jsp
> 
> <s:if test="${resultSize} > 0">
> 
> I changed it to 
> <s:if test="%{resultSize>0}" >
> Now the error went away.  But the statement never
> evaluated true.  I
> took out the s:if statement, the result showed up
> corrected.  resultSize
> is a request attribute.
> 
> Please advice,
> 
> Jane
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] s:if in 2.0.11

Posted by Dave Newton <ne...@yahoo.com>.
You're trying to mix expression languages.

%{resultSize > 0} assumes that resultSize is on the
value stack, most likely exposed via a public getter
on your action. This is arguably a better practice
anyway.

If the list itself is available on the stack then you
can call the size() method on the list in your <s:if
test="..."> OGNL expression and do away with the
request attribute altogether, which is arguably
cleaner anyway.

d.

--- "Jiang, Jane (NIH/NCI) [C]" <ji...@mail.nih.gov>
wrote:

> I am upgrading to 2.0.11 from 2.0.9 and got this
> error
> 
> SEVERE: Servlet.service() for servlet jsp threw
> exception
> org.apache.jasper.JasperException:
> /jsp/content/findAcrResults.jsp(6,0)
> According to TLD or attribute directive in tag file,
> attribute test does
> not accept any expressions
> 
> for this line in my jsp
> 
> <s:if test="${resultSize} > 0">
> 
> I changed it to 
> <s:if test="%{resultSize>0}" >
> Now the error went away.  But the statement never
> evaluated true.  I
> took out the s:if statement, the result showed up
> corrected.  resultSize
> is a request attribute.
> 
> Please advice,
> 
> Jane
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org