tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Menard <m...@mjm.net>
Subject <c:set> vs. <bean:define> and <%= %> behavior question
Date Tue, 03 Feb 2004 21:11:05 GMT
First I have been struggling with this for a while now. I'm also new to JSP
having used XMLC for presentation in the past.

I have the following page:

1:  <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
2:  <%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
3:
4:  <c:set var="var1" value="var1" scope="page" />
5:  <c:out value="${var1}" />
6:  <bean:define id="var2" value="var2" toScope="page" />
7:  <%= var2 %>
8:
9:  <%@ include file="/mark/dumpscopes.jsp" %>

This runs fine, but if I change the <c:out> on line 5 to <%= var1 %> I get
the following compilation error:

Generated servlet error:
    [javac] Compiling 1 source file
    [javac] 
/Users/mark/opt/JBoss-3.2.3/server/default/work/MainEngine/localhost/mori/ma
rk/mypage_jsp.java:65: cannot resolve symbol
    [javac] symbol  : variable var1
    [javac] location: class org.apache.jsp.mypage_jsp
    [javac]       out.print( var1 );
    [javac]                  ^
    [javac] 1 error


I have looked at the source for <c:set> and <bean:define> and if I'm looking
at it right they both set the variable in the same manner:

>From org.apache.struts.taglib.bean.DefineTag line 288
(jakarta-struts-1.1-src/src/share/org/apache/struts/taglib/bean/DefineTag.ja
va):

        pageContext.setAttribute(id, value, inScope);

>From org.apache.taglibs.standard.tag.common.core.SetSupport line 144
(jakarta-taglibs-standard-1.0.5-src/standard/src/org/apache/taglibs/standard
/tag/common/core/SetSupport.java):

        pageContext.setAttribute(var, result, scope);

I'm curious as to why <%= %> works with a variable defined using
<bean:define> but not with one defined using <c:set>.

Additionally I have dumped the scope to see if var1 exists in the page
context when using the <c:out> version and it is there.

Environment:

Jboss-3.2.3 w/ included Tomcat 4.1.29
OS X Panther 10.3.2 w/ JDK 1.4.2_03
Ant 1.6

Thanks much,

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message