tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Menard <>
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" %>
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 %>
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
rk/ 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

        pageContext.setAttribute(id, value, inScope);

>From org.apache.taglibs.standard.tag.common.core.SetSupport line 144

        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.


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,


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message