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]

Reply via email to