Olaf;
I did what you said but now Im getting a transient error. Literally it will a random number of times in a row and then it will exception with the following message.
org.apache.jasper.JasperException: /JSPs/AdminSubscribers.jsp(21,1) According to TLD or attribute directive in tag file, attribute test does not accept any expressions org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146) org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:955) org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:710) org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163) org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213) org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219) org.apache.jasper.compiler.Node$Root.accept(Node.java:456) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163) org.apache.jasper.compiler.Validator.validate(Validator.java:1489) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:157) org.apache.jasper.compiler.Compiler.compile(Compiler.java:286) org.apache.jasper.compiler.Compiler.compile(Compiler.java:267) org.apache.jasper.compiler.Compiler.compile(Compiler.java:255) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245) javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Then it will work again.
Im beginning to wonder if this is a Tomcat 5.5.4 bug. This is driving me nuts and blowing my schedule all to hell.
-- Robert
Olaf Bergner wrote:
Which is a version 2.3 web dd, _not_ a version 2.4 dd. I think you have the following options:
(1) Upgrade to version 2.4 via
<?xml version="1.0" encoding="ISO-8859-1"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
which will put the burden of evaluating EL expressions on the servlet container. You might have to switch to the most recent version of the JSTL afterwards, since it seems as if your current version handles EL evaluation on itself.
(2) Keep version 2.3 and modify your custom JSP tags to handle EL evaluation themselves, using for instance Apache's EL implementation.
(3) Make your servlet container take over EL evaluation on a per-page basis via the page directive <%@ page isELIgnored="false" %>.
At the end of the day, it all boils down to the question: who is evaluating your EL expressions, your servlet container or your tag? Being lazy, I would almost always opt for the servlet container.
Cheers,
Olaf
-----Ursprüngliche Nachricht----- Von: news [mailto:[EMAIL PROTECTED] Auftrag von Robert Simmons Jr. Gesendet: Dienstag, 4. Januar 2005 17:00 An: taglibs-user@jakarta.apache.org Betreff: Re: AW: Newbie Question: EL in attributes for a custom tag not being evaluated??
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.AxisHTTPSessionList ener</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 byhigher. In
default only if the web deployment descriptor is version 2.4 or
this case, EL expressions are evaluated by the servletcontainer, _not_ the
version 2.4. InJSP 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
this case EL evaluation is handled by the servlet container and your tagsevaluation in
_must not_ attempt to evaluate those expressions themselves. Or you are
operating in a pre JSP 2.0 environment (< 2.4) and handle EL
your custom JSP tags, since the servlet container does nothingto help you
between JSPhere.
All this confusion stems from the fact that the main difference
1.2 and JSP 2.0 is that while in JSP 1.2 it is the JSP tag'sresponsibility
to evaluate EL expressions in JSP 2.0 this is the servletcontainer's job.
That's exactly why tags which call themselves EL enabled usuallywon't work
in a JSP 2.0 environment. These tags handle EL evaluation internally andservlet container
thus EL expressions will get evaluated twice, first by the
description.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]>:
Greetings;
I have a tag that I created to allow integration with my back end. I am using the Jakarta astandard taglibs extensively in the
application but I
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>com.bmw.candy.candiedServices.tags.TagSubscriptionInfo< /tag-class>
<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> <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
JSP variables.
*/ 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");
//$NON-NLS-1$
SubscriptionAccess 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
description. */ public void setDescriptionVar(String descriptionVar) { this.descriptionVar = descriptionVar; }
/** * @param itemVar The variable in which to store the
subscription items.
*/ public void setItemsVar(String itemsVar) { this.itemsVar = itemsVar; }
/** * @param nameVar The variable in which to store the
subscription name.
*/ 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
subscription
last sequence number. */ public void setSequenceNumVar(String sequenceNumVar) { this.sequenceNumVar = sequenceNumVar; } }
So what Might I be doing wrong? I have googled for this for
hours on end
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]