tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Milanez, Marcus" <Marcus.Mila...@diebold.com>
Subject Possible Bug Regarding Tag Files
Date Thu, 28 Jun 2007 13:50:23 GMT

Hi everyone,

As I'm not a native english speaker, I might possibly commit mistakes
during this report, so I ask your apologize in advance. 

I've researched at google and at tomcat's web site but couldn't find any
satisfatory answer regarding the following behaviour: whenever I use
Expression Language inside ".tag" files, I can't invoke getXXX() methods
that are not declared inside that class instance, but in its superclass
instead. For a matter of example, imagine that I have the following two
(stupid) classes:

public class AbstractFruit() {

	...

	public String getName() {

	}

}

public class Apple extends AbstractFruit() {

	...

	public String getColor() {

	}

}


Inside my servlet I create the following request attribute:

	AbstractFruit apple = new Apple();
	request.setAttribute("myFruit", apple);
	request.getRequestDispatcher("/myTest.jsp").forward(request,
response);


And then I forward to my JSP that makes use of a tag file, just like the
following examples:

myTest.jsp
	<%@ taglib prefix="fruitsUtils" tagdir="/WEB-INF/tags/" %>
	<fruitsUtils:mix fruit='${requestScope["myFruit"]}'/>

/WEB-INF/tags/mix.tag
	<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
	<%@ attribute name="fruit" required="true" %>

	<c:out value='${fruit.name}' /> --> At this very moment, I get a
runtime exception because I'm trying to invoke a superclass method


This situation seems somehow strange because if I use the same syntax in
a common JSP file I get it done perfectly, as usual. I believe that
somehow the implementation of tag files compilation use different
approaches for Expression Language reflections... Or I might be doing
something extremely wrong without knowledge..

Has someone seen that before? I used Tomcat 6.0.10 during this test.

Thank you!

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message