Addendum:
My web.xml is here ...
<?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>Apache-Axis</display-name>
<listener>
<listener-class>org.apache.axis.transport.http.AxisHTTPSessionListener</listener-class>
</listener>
<resource-env-ref>
<description>Main Data Source</description>
<resource-env-ref-name>jdbc/CandiedServices</resource-env-ref-name>
<resource-env-ref-type>javax.sql.DataSource</resource-env-ref-type>
<res-auth>Container</res-auth>
</resource-env-ref>
<servlet>
<servlet-name>AxisServlet</servlet-name>
<display-name>Apache-Axis Servlet</display-name>
<servlet-class> org.apache.axis.transport.http.AxisServlet </servlet-class>
</servlet>
<servlet>
<servlet-name>AdminServlet</servlet-name>
<display-name>Axis Admin Servlet</display-name>
<servlet-class> org.apache.axis.transport.http.AdminServlet </servlet-class>
<load-on-startup>100</load-on-startup>
</servlet>
<servlet>
<servlet-name>SOAPMonitorService</servlet-name>
<display-name>SOAPMonitorService</display-name>
<servlet-class> org.apache.axis.monitor.SOAPMonitorService </servlet-class>
<init-param>
<param-name>SOAPMonitorPort</param-name>
<param-value>5001</param-value>
</init-param>
<load-on-startup>100</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/servlet/AxisServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>*.jws</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SOAPMonitorService</servlet-name>
<url-pattern>/SOAPMonitor</url-pattern>
</servlet-mapping>
<!-- uncomment this if you want the admin servlet -->
<servlet-mapping>
<servlet-name>AdminServlet</servlet-name>
<url-pattern>/servlet/AdminServlet</url-pattern>
</servlet-mapping>
<session-config>
<!-- Default to 5 minute session timeouts -->
<session-timeout>5</session-timeout>
</session-config>
<!-- currently the W3C havent settled on a media type for WSDL;
http://www.w3.org/TR/2003/WD-wsdl12-20030303/#ietf-draft
for now we go with the basic 'it's XML' response -->
<mime-mapping>
<extension>wsdl</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xsd</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<welcome-file-list id="WelcomeFileList">
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.jws</welcome-file>
</welcome-file-list>
</web-app>
Thanks
-- Robert
Olaf Bergner wrote:
I'll second to that. According to the spec, EL evaluation is turned on by default only if the web deployment descriptor is version 2.4 or higher. In this case, EL expressions are evaluated by the servlet container, _not_ the JSP tag.
Presumably, you are using a JSTL version that delegates evaluation of EL expressions to the JSP tags and does not rely on the servlet container's doing so.
The long and short of it: either you are operating in a pure JSP 2.0 environment and make this known by upgrading your web.xml to version 2.4. In this case EL evaluation is handled by the servlet container and your tags _must not_ attempt to evaluate those expressions themselves. Or you are operating in a pre JSP 2.0 environment (< 2.4) and handle EL evaluation in your custom JSP tags, since the servlet container does nothing to help you here.
All this confusion stems from the fact that the main difference between JSP 1.2 and JSP 2.0 is that while in JSP 1.2 it is the JSP tag's responsibility to evaluate EL expressions in JSP 2.0 this is the servlet container's job. That's exactly why tags which call themselves EL enabled usually won't work in a JSP 2.0 environment. These tags handle EL evaluation internally and thus EL expressions will get evaluated twice, first by the servlet container and then by the JSP tag.
Hope this makes things a little clearer,
Olaf
-----Ursprüngliche Nachricht----- Von: Kris Schneider [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 4. Januar 2005 13:53 An: Tag Libraries Users List Betreff: Re: Newbie Question: EL in attributes for a custom tag not being evaluated??
Robert,
Since it looks like you're using javax.servlet.jsp.tagext.SimpleTagSupport, I'll assume your're running on a JSP 2.0 container. I haven't looked closely at the rest of your code yet, but the first thing to do is make sure your web app is using a Servlet 2.4 deployment descriptor (web.xml).
Quoting "Robert Simmons Jr." <[EMAIL PROTECTED]>:
application but IGreetings;
I have a tag that I created to allow integration with my back end. I am
using the Jakarta astandard taglibs extensively in the
<tag-class>com.bmw.candy.candiedServices.tags.TagSubscriptionInfo<am a bit of a taglib newbie and I have a problem. Namely when I use EL expressions in my tag attributes, they get passed verbatim to the tag and never evaluated.
For example, if I use:
<cs:subscriptionInfo targetID="${subID}" nameVar="subName" descriptionVar="subDesc"/>
Then targetID gets passed the literal string ${subID} which causes the page to explode since targetID needs to be a long. The TLD for this tag is indicated below:
<tag> <description> Fetches information on a particular subscription. </description> <name>subscriptionInfo</name>
/tag-class>
JSP variables.<body-content>empty</body-content> <attribute> <description> ID of the subscription for which to obtain info. </description> <name>targetID</name> <type>java.lang.Long</type> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <description> The variable in which to store the subscription name. </description> <name>nameVar</name> <type>java.lang.String</type> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <description> The variable in which to store the subscription description. </description> <name>descriptionVar</name> <type>java.lang.String</type> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <description> The variable in which to store the subscription items. </description> <name>itemsVar</name> <type>java.lang.String</type> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <description> The variable in which to store the subscription last sequence number. </description> <name>sequenceNumVar</name> <type>java.lang.String</type> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> </tag>
You can see that I set rtexprvalue to true in all cases yet there is no resolution hapening. The implementation of this tag is shown here:
import java.io.IOException;
import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.SimpleTagSupport;
import com.bmw.candy.candiedServices.SubscriptionAccess; import com.bmw.candy.candiedServices.data.Subscription;
/**
* Get the information on a subscription and store it in some
//$NON-NLS-1$*/ public class TagSubscriptionInfo extends SimpleTagSupport { /** The ID of the subscription to obtain info on. */ private long targetID = -1;
/** The variable in which to store the subscription name. */ private String nameVar = null;
/** The variable in which to store the subscription description. */ private String descriptionVar = null;
/** The variable in which to store the subscription items. */ private String itemsVar = null;
/** The variable in which to store the subscription last sequence number. */ private String sequenceNumVar = null;
/** [EMAIL PROTECTED] */
public void doTag() throws JspException, IOException {
if (this.targetID < 0)
throw new IllegalArgumentException("targetID");
subscriptionSubscriptionAccess access = new SubscriptionAccess(); Subscription subscription = access.getSubscriptionInfo(this.targetID); if (this.nameVar != null) { getJspContext().setAttribute(this.nameVar, subscription.getName()); } if (this.descriptionVar != null) { getJspContext().setAttribute(this.descriptionVar, subscription.getDescription()); } if (this.itemsVar != null) { getJspContext().setAttribute(this.itemsVar, subscription.getItems()); } if (this.sequenceNumVar != null) { getJspContext().setAttribute(this.sequenceNumVar, new Integer(subscription.getSequenceNum())); } }
/**
* @param descriptionVar The variable in which to store the
subscription items.description. */ public void setDescriptionVar(String descriptionVar) { this.descriptionVar = descriptionVar; }
/**
* @param itemVar The variable in which to store the
subscription name.*/ public void setItemsVar(String itemsVar) { this.itemsVar = itemsVar; }
/**
* @param nameVar The variable in which to store the
subscription*/ public void setNameVar(String nameVar) { this.nameVar = nameVar; }
/** * @param targetID The ID of the subscription to obtain info on. */ public void setTargetID(long targetID) { this.targetID = targetID; }
/**
* @param sequenceNumVar The variable in which to store the
hours on endlast sequence number. */ public void setSequenceNumVar(String sequenceNumVar) { this.sequenceNumVar = sequenceNumVar; } }
So what Might I be doing wrong? I have googled for this for
with no enlightenment. I am currently using the jsp:attribute tag to work around this but would really like to fix this once and for all.
Thanks in advance.
-- Robert
-- Kris Schneider <mailto:[EMAIL PROTECTED]> D.O.Tech <http://www.dotech.com/>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]