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 Michael Winkler <mi...@liwest.at> on 2005/10/13 22:28:16 UTC
Addressing variables with jstl
Hi,
I've . g. two classes:
public class A {
private int i;
...
}
and
public class B {
private A a;
...
}
further in my JSP:
<jsp:useBean id="B" class="../B"/>
Now my question: is it possible to address the variable i in Class A with the jstl?
<jsp:getProperty name="B" property="a"/>
<c:out value="${a.i}"/>
prints the memory address ...
<c:out value="${B.a.i}"/>
won't work - i is not public ...
Of curse it works with:
<% out.println(B.getA().getI()); %>
but with jstl?
I've no idea. Thanks for your Support,
Michael
Re: Addressing variables with jstl
Posted by Kris Schneider <kr...@dotech.com>.
Although I originally wrote it as part of the Struts Wiki, this page is
helpful for determining the actual properties exposed by your bean/class:
http://wiki.apache.org/struts/ExposedBeanProperties
JSTL should be able to deal with pretty much anything that's exposed as a
standard JavaBeans property.
Michael Winkler wrote:
> Hi,
>
>
>
> I've . g. two classes:
>
>
>
> public class A {
>
> private int i;
>
> ...
>
> }
>
>
>
> and
>
>
>
> public class B {
>
> private A a;
>
> ...
>
> }
>
>
>
> further in my JSP:
>
>
>
> <jsp:useBean id="B" class="../B"/>
>
>
>
> Now my question: is it possible to address the variable i in Class A with the jstl?
>
>
>
> <jsp:getProperty name="B" property="a"/>
>
> <c:out value="${a.i}"/>
>
> prints the memory address ...
>
>
>
> <c:out value="${B.a.i}"/>
>
> won't work - i is not public ...
>
>
>
> Of curse it works with:
>
> <% out.println(B.getA().getI()); %>
>
> but with jstl?
>
>
>
> I've no idea. Thanks for your Support,
>
>
>
> Michael
--
Kris Schneider <ma...@dotech.com>
D.O.Tech <http://www.dotech.com/>
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org