Can you point me to a particular file that shows what you are talking about?
I've looked through both the tags in the distribution and CVS, but haven't
found an example.

Thanks!

> -----Original Message-----
> From: Karr, David [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 31, 2002 7:54 AM
> To: Tag Libraries Users List
> Subject: RE: Cooperating tag
> 
> 
> In JSP 1.2, you have to specifically use the API for the JSTL 
> expression language engine if you want attributes to use the 
> "${...}" syntax.  In JSP 2.0, this will happen automagically, 
> but we're not there yet.
> 
> If you want one example of how this is done, look at the 
> Struts-EL contrib library, which is part of the Struts 
> distribution.  You'll find that the Tag classes pass the 
> attribute values through the EL to generate the final value.
> 
> > -----Original Message-----
> > From: Randy Belknap [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, December 30, 2002 5:29 PM
> > To: '[EMAIL PROTECTED]'
> > Subject: Cooperating tag
> > 
> > 
> > Should I be able to create a variable using <c:set> and then 
> > use it to set
> > the value of an attribute in my own custom tag? 
> > 
> > When I try and use "${myVar}" to pass the value to my 
> custom tag, what
> > receive is the literal "${myVar}".  In otherwords it doesn't 
> > evaluate the
> > expression.  I've tested under Tomcat 4.0.6, 4.1.17 and 4.1.18.
> > 
> > I've created the smallest possible test case and am including 
> > all the files.
> > 
> > 
> > Thanks,
> > 
> > Randy
> > 
> > === JSP PAGE ===
> > <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"; %>
> > <%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml"; %>
> > <%@ taglib uri="portaltags" prefix="xe" %>
> > <html><body>
> > 
> > <c:set var="myVar" scope="page" value="1"/>
> > 
> > <p><xe:MsgType messageType="${myVar}"/>
> > 
> > </body></html>
> > 
> > === The taglib.tld ===
> > <?xml version="1.0" encoding="ISO-8859-1" ?>
> > <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP 
> > Tag Library
> > 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd";>
> > 
> > <taglib>
> >    <tlibversion>1.0</tlibversion>
> >    <jspversion>1.2</jspversion>
> >    <shortname>xe</shortname>    
> >    <uri>http://www.test.com/portaltags.html</uri>    
> >    <info>XePortal</info>
> >     
> >    <tag>        
> >     <name>MsgType</name>
> >     <tagclass>com.test.XeTestTag</tagclass>
> >     <info>Gets message types</info>
> >        <attribute>
> >          <name>messageType</name>
> >          <required>true</required>
> >          <rtexprvalue>true</rtexprvalue>
> >        </attribute>
> >     </tag>
> > </taglib>
> > 
> > === The web.xml ===
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> > 
> > <!DOCTYPE web-app
> >     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> >     "http://java.sun.com/dtd/web-app_2_3.dtd";>
> > 
> > <web-app>
> >   <display-name>Portal</display-name>
> >   <description>
> >      Portal 
> >   </description>
> >   
> >   <taglib>        
> >     <taglib-uri>portaltags</taglib-uri>
> >     <taglib-location>/WEB-INF/taglib.tld</taglib-location>    
> >   </taglib>
> > 
> > </web-app>
> > 
> > === The Java file ===
> > package com.test;
> > 
> > import javax.servlet.jsp.JspTagException;
> > import javax.servlet.jsp.tagext.TagSupport;
> > 
> > public class XeTestTag extends TagSupport
> > {
> >     private String messageType = "0";
> >     /**
> >      * Constructor for XeTestTag.
> >      */
> >     public XeTestTag()
> >     {
> >             super();
> >     }
> > 
> >     /**
> >      * Sets the messageType.
> >      * @param messageType The messageType to set
> >      */
> >     public void setMessageType(String messageType)
> >     {
> >             this.messageType = messageType;
> >             System.out.println("MessageType: " + messageType);
> >     }
> > 
> >     /** 
> >      * Output the requested function.
> >      * @return int
> >      */
> >     public int doEndTag() throws JspTagException
> >     {
> >             try
> >             {
> >                     pageContext.getOut().write(messageType);
> >             }
> >             catch (java.io.IOException e)
> >             {
> >                     throw new JspTagException("IO Error: " +
> > e.getMessage());
> >             }
> >             return EVAL_PAGE;
> >     }
> > 
> > }
> > 
> > --
> > To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to