tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pete Gordon <PGor...@fourthchannel.com>
Subject RE: Jsp compilation of nested custom tags (porting from weblogic 6 to tomcat 4.0.3)
Date Fri, 07 Jun 2002 15:42:45 GMT
Thanks Kin-Man.

I have filed a bug on Tomcat-Jasper component (BUG# 9699).  I was able to
duplicate the problem using the examples\foo simple tag example by just
trying to nest the tag within itself (see code below).

If you have pointers on where the generate java code might be, I might be
able to try to look at it.

Pete Gordon


foo.jsp
<html>
<!--
  Copyright (c) 1999-2001 The Apache Software Foundation.  All rights 
  reserved.
-->
<body>
<%@ taglib uri="http://jakarta.apache.org/tomcat/examples-taglib"
prefix="eg"%>

Radio stations that rock:

<ul>
<eg:foo att1="98.5" att2="92.3" att3="107.7">
<li><%= member %></li>
	<eg:foo att1="11.1" att2="22.2" att3="33.3">
	  This is the some more members.
	</eg:foo>
</eg:foo>
</ul>

<eg:log>
Did you see me on the stderr window?
</eg:log>

<eg:log toBrowser="true">
Did you see me on the browser window as well?
</eg:log>

</body>
</html>



-----Original Message-----
From: Kin-Man Chung [mailto:Kin-Man.Chung@Eng.Sun.COM] 
Sent: Thursday, June 06, 2002 8:40 PM
To: tomcat-dev@jakarta.apache.org
Subject: Re: Jsp compilation of nested custom tags (porting from weblogic 6
to tomcat 4.0.3)


I assume that lOffset is a scripting variable defined either in a <variable>
element of a tld, or in a TagExtraInfo, and that its declaration (in the
generated java file) is a result of the compiler trying to do its
synchronization with the pagecontext attribute of the same name.

If so, what is the scope of this variable?  Is it NESTED or AT_BEGIN?

I can see how the current Jasper implementation can be problematic, There
are two problems here.

First, if the scope is AT_BEGIN, then the scope of the variable should
remain defined until the end of the page, and the current implementation
actually make it unavailable after the end of the tag, which is wrong.

Second, if the tags are nested, as is your case here, then redclaring it in
the nested block would be illegal Java.

Can you file a bug report in bugzilla for this?  It would help if you can
also include a small test case, so that fixes can be verified.

Thanks.


> Date: Thu, 06 Jun 2002 18:54:11 -0400
> From: Pete Gordon <PGordon@fourthchannel.com>
> Subject: Re: Jsp compilation of nested custom tags (porting from 
> weblogic 6 to
tomcat 4.0.3)
> To: Tag Libraries Developers List <taglibs-dev@jakarta.apache.org>
> Cc: tomcat-dev@jakarta.apache.org
> MIME-version: 1.0 (Apple Message framework v481)
> Delivered-to: mailing list tomcat-dev@jakarta.apache.org
> Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm
> X-Antivirus: nagoya (v4198 created Apr 24 2002)
> X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N
> List-Post: <mailto:tomcat-dev@jakarta.apache.org>
> List-Subscribe: <mailto:tomcat-dev-subscribe@jakarta.apache.org>
> List-Unsubscribe: <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
> List-Help: <mailto:tomcat-dev-help@jakarta.apache.org>
> List-Id: "Tomcat Developers List" <tomcat-dev.jakarta.apache.org>
> 
> Thanks, Shawn.
> 
> Let me summarize for the tomcat-dev list.  I have an existing
> application with custom tags that runs on weblogic 6, when porting it 
> over to Tomcat I now am running into an error where the generated java 
> from a jsp with self nested tags will not compile, the code generated 
> from jspc simulates the HelloWorld sample below, which is not valid java
> 
> code--it would be valid in C, but that's another story.
> 
> The first htmlGlobalAttribSearch$jsp.java compile error is line 198,
> variable lOffset is already defined.  There are several (19) more errors
> 
> like this that are also outputed from trying to compile the $jsp.java
> file that I have attached.
> 
> public class HelloWorld{
> 	public static void main(String args[]){
> 		do{
> 			int i = 5;
> 			do{
> 				int i=10;
> 			}while(false);
> 		}while(false);
> 	}
> }
> 
> Tomorrow, I will try to create a minimal nested tag example and see if 
> I
> 
> can duplicate the problem.  Unless someone is aware of this problem
> already, and can save me the effort.
> 
> Thanks,
> Pete Gordon
> 
> 
> 
> On Thursday, June 6, 2002, at 03:03 PM, Shawn Bayern wrote:
> 
> > Hi Pete,
> >
> > If this is a Tomcat bug, it would be better to mail tomcat-dev about
> it
> > or
> > to submit a Tomcat bug report in Apache's Bugzilla 
> > (http://nagoya.apache.org/bugzilla).  I'd be happy to take a look at
> it
> > myself, but it's difficult to identify the problem in a large 
> > compiled servlet.  (I can't attempt to compile it myself since it 
> > depends on
> some
> > custom classes not included.)  If you could post the compilation
> error,
> > that'd definitely help us determine whether it looks like a Tomcat 
> > bug
> 
> > or
> > not.
> 
> 
> 
> From: Pete Gordon <PGordon@fourthchannel.com>
> Date: Thu Jun 06, 2002  02:32:06 PM US/Eastern
> To: 'Tag Libraries Developers List' <taglibs-dev@jakarta.apache.org>
> Subject: Jsp compilation of nested custom tags (porting from weblogic 
> 6
> to tomcat 4.0.3)
> Reply-To: "Tag Libraries Developers List" <taglibs-
> dev@jakarta.apache.org>
> 
> There is a problem with compiling the genenerated java code
> (htmlGlobalAttribSearch$jsp.java) it tells me that variables have 
> already been defined.  I have compiled the source file and even 
> created a test HelloWorld.java to test it.  It is correct variables 
> have already been defined, which we found strange as far as the scope 
> variables were accessible, see the code below....
> 
> public class HelloWorld{
> 	public static void main(String args[]){
> 		do{
> 			int i = 5;
> 			do{
> 				int i=10;
> 			}while(false);
> 		}while(false);
> 	}
> }
> 
> The JSP page has several nested custom tags (the same tags) and this 
> is working on weblogic 6.  But the generated java file from 
> tomcat/jasper does not compile.  The problem is the <fci:collection> 
> tag being nested a few times within itself.  See the JSP below.  I 
> think this is a problem with
> 
> the
> jspc generated java code.  Am I way off base?
> 
> Thanks,
> Pete Gordon
> 
> <%@ taglib uri="fciTagLib.tld" prefix = "fci" %>
> <%@ page import="com.fci.arch.service.*"%>
> 
> <form action="<fci:get resource="site"/>" method="GET" id=form1
> name=form1>
> <input type="hidden" name="action" 
> value="catalogActions.globalParametric">
> <input type="hidden" name="searchPerfomed" value="true">
> 
> <table width="<fci:get resource="catNavWidth"/>" cellspacing="2" 
> cellpadding="2" border="0"> <tr>
> 	<td><fci:get resource="Parametric.Instructions"/></td>
> </tr>
> <fci:collection name="globalAttributeSearchDetail">
> 	<fci:collection name="pSearchAttributeType" cacheLevel="none">
> 	<tr>
> 		<td>
> 			<fci:get resource="Prefix.Content"/>
> 			<fci:element name="Name"/>
> 			<br>
> 			<select name="<fci:element name="Name"/>">
> 				<option value="~all~">all</option>
> 				<fci:collection
> name="globalAttributeValues"
> cacheLevel="none">
> 					<% String value =
> ((Agent)pageContext.getAttribute("pSearchAttributeType.currentDO")).getP
> rope
> rty("Name").toString(); %>
> 					<fci:element name="Value"
> format="option" compare="<%= value %>"/>
> 				</fci:collection>
> 			</select>
> 			<fci:get resource="Suffix.Content"/>
> 		</td>
> 	</tr>
> 	</fci:collection>
> </fci:collection>
> <fci:nonempty collection="globalAttributeSearchDetail">
> <tr>
> 	<td align="left">
> 		<br><fci:get resource="Button.AttributeSearch"/>
> 	</td>
> </tr>
> </fci:nonempty>
> </table>
> </form>
> 
> 
> 
> 
> <File attached: htmlGlobalAttribSearch$jsp.java>--
> 
>  
> 


--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message