That was very enlightening but I wonder how I can resolve the issue. I am using the Jakarta Taglibs Standard 1.1 and Tomcat 5.5.4 along with Apache Axis (current version). I am not sure how these meld together since I am no expert with web apps and integrating all of these frameworks. The good news is that my workaround works for now. The bad news is that I would like to actually know how to fix this.

-- 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]>:



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.
       </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]

Reply via email to