You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by flare <fl...@flare.it> on 2002/10/27 09:43:17 UTC

JSTL BUG? Url problem

Hi, I've to iterate a collection of dynabeans (asteAllegati) and encode a URL using a 
parameter (key) that is a property of a dynabean

<c:forEach var="item" items="${requestScope.asteAllegati}" varStatus="status">
<c:url value="/showAllegati.do" var="show">
<c:param name="id" value="${requestScope.id}"/>
<c:param name="tipo" value="${requestScope.tipo}" />
<c:param name="key" value="${item.a_nomefile}" />
</c:url>
...

the code is straightforward, the problem is that I get an error message when JSTL try to 
render the third parameter

javax.servlet.jsp.JspException: An error occurred while evaluating custom
action attribute "value" with value "${item.a_nomefile}": Unable to find
a value for "a_nomefile" in object of class "org.apache.commons.beanutils.BasicDynaBean"
using operator "." (null)



if I use the following (unreadable) code it works: 

<a href='showAllegati.do?id=<c:out value="${requestScope.id}"/>&tipo=<c:out 
value="${requestScope.tipo}"/>&key=<c:out value="${item.a_nomefile}" />'>


is that a bug or simply dynabens cannot be used that way? 

Thanx 


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


Re: JSTL BUG? Url problem

Posted by flare <fl...@flare.it>.
> 
> I'm not really familiar with DynaBeans and how they work.  My point is
> just that if 

dynabeans are not javabeans , since they've dynamic properties you should access them 
using  bean.get("property") instead of bean.getProperty() 
The jstl out tag supports this method of invocation, perhaps other tags have problems with 
it 
 

 -- 
> Shawn Bayern
> "JSTL in Action"   http://www.jstlbook.com
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>
> 



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


Re: JSTL BUG? Url problem

Posted by Shawn Bayern <ba...@essentially.net>.
On Mon, 28 Oct 2002, flare wrote:

> <c:forEach var="item" items="${requestScope.asteAllegati}" varStatus="status">
>  <c:url value="/showAllegati.do" var="show">
>  <c:param name="id" value="${requestScope.id}"/>
>  <c:param name="tipo" value="${requestScope.tipo}" />
>  <c:param name="key" value="${item.a_nomefile}" />
>  </c:url>
> ... 
> 
> I've tried but doesn't work.. if I try to render the url with a
> dynabean accessor (a_nomefile or others) I get an error, the out tag
> works fine instead.  I'm using JSTL on Resin 2.1.5 + Linux

I'm not really familiar with DynaBeans and how they work.  My point is
just that if 

  <c:out value="${item.a_nomefile}" />

works, then a <c:param> tag that uses the same expression ought to work as
well.  Your previous message indicated that there was some difference
between the two in the same JSP page, and I wanted to confirm that that
was what you meant.

-- 
Shawn Bayern
"JSTL in Action"   http://www.jstlbook.com


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


Re: JSTL BUG? Url problem

Posted by flare <fl...@flare.it>.
> On Sun, 27 Oct 2002, flare wrote:
> 
> Irrespective of whether you're using DynaBeans or not, if it works in
> the latter case, it should work in the former one.  That is, the two
> expressions you've shown are identical, and both tags evaluate their
> attributes as String objects.

<c:forEach var="item" items="${requestScope.asteAllegati}" varStatus="status">
 <c:url value="/showAllegati.do" var="show">
 <c:param name="id" value="${requestScope.id}"/>
 <c:param name="tipo" value="${requestScope.tipo}" />
 <c:param name="key" value="${item.a_nomefile}" />
 </c:url>
... 

I've tried but doesn't work.. if I try to render the url with a dynabean accessor (a_nomefile or 
others) I get an error, the out tag works fine instead.  
I'm using JSTL on Resin 2.1.5  + Linux     

500 Servlet Exception

javax.servlet.jsp.JspException: An error occurred while evaluating custom
action attribute "value" with value "${item.a_nomefile}": Unable to find
a value for "a_nomefile" in object of class "org.apache.commons.beanutils.BasicDynaBean"
using operator "." (null)
at org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:146)
at org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:166)
at 
org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.evaluate(Expressio
nEvaluatorManager.java:112)
at 
org.apache.taglibs.standard.tag.el.core.ExpressionUtil.evalNotNull(ExpressionUtil.java:85)
at 
org.apache.taglibs.standard.tag.el.core.ParamTag.evaluateExpressions(ParamTag.java:14
8)
at org.apache.taglibs.standard.tag.el.core.ParamTag.doStartTag(ParamTag.java:100)
(...)


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


Re: JSTL BUG? Url problem

Posted by Shawn Bayern <ba...@essentially.net>.
On Sun, 27 Oct 2002, flare wrote:

> <c:param name="key" value="${item.a_nomefile}" />
> [...]
> <a href='showAllegati.do?id=<c:out value="${requestScope.id}"/>&tipo=<c:out 
> value="${requestScope.tipo}"/>&key=<c:out value="${item.a_nomefile}" />'>
> 
> is that a bug or simply dynabens cannot be used that way? 

Irrespective of whether you're using DynaBeans or not, if it works in the
latter case, it should work in the former one.  That is, the two
expressions you've shown are identical, and both tags evaluate their
attributes as String objects.

-- 
Shawn Bayern
"JSTL in Action"   http://www.jstlbook.com


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