tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davidson, Misha" <>
Subject Bug in Struts examples
Date Wed, 05 Jul 2000 15:02:37 GMT

I have noticed a problem with one of the examples that come with Struts.
It relies on a specific (spec non-compliant) behavior in tomcat/jakarta.
I'd like to fix it, but since I am pretty new to this group, I would 
any advice as to the best way of correcting the problem.
One of the example pages that come with Struts (subscription.jsp, line 43)
contains a statement
	<jsp:getProperty name="user" property="username"/>
without explicitly defining what bean is referred to as "user". I would like
to add a "useBean" statement to that page. Here's why.

JSP 1.1 spec section 2.12.3 explicitly says that the bean instance used by
"jsp:getProperty" tag "bust be defined [sic] before this point in the page
(usually via a useBean action)." Similarly, the definition for 
(section 2.13.2) says "The defining element (in JSP 1.1 only a <jsp:useBean>)
must appear before the <jsp:setProperty> element in the same file.

subscription.jsp does not declare the bean "user" in any way.
This works fine with jakarta/tomcat because the Java code generated by
Jasper's JSP compiler does not rely on the bean being declared on the
page (it simply uses PageContext.findAttribute()). However, this behavior is
not very precise (what if I want a "user" bean from a different scope?), it
violates the spec (see above) and it will not compile in other spec-compliant

So what can I do here? Fix the Struts example? Change code generation in 
Any advice will be greatly appreciated.

-Misha Davidson

View raw message