You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Stefan <ni...@studioweb.com> on 2002/10/21 18:04:05 UTC

Using rtexprvalue.

Hi,

I have a problem using rtexprvalue taglibs and some scripting expressions where some work fine like this one:

<fmt_rt:formatDate value="<%= rs.getDate("lastVisitDate") %>"/>

and others like :

    <c_rt:if test='<%=rs.getString("sex")%>'>
     Man
    </c:if>
    
    <c_rt:if test='<%=rs.getString("sex")%>'> 
            Female
    </c:if>

gives me errors such as:

' expected at end of file. For XML, the top-level tag must have a matching closing tag

I am importing the following two libraries into the pages:

<%@ taglib prefix='fmt_rt' uri='http://java.sun.com/jstl/fmt_rt' %>
<%@ taglib prefix='c_rt' uri='http://java.sun.com/jstl/core_rt' %>

In the above examples the JSTL tags are being used inside a while loop that is iterating over a rowset provided by a bean method that has made the database query.

Thanks,

Stef
  




Re: Using rtexprvalue.

Posted by Stefan <ni...@studioweb.com>.
Ooops!

Thanks,

Stef
----- Original Message -----
From: "Ryan Lubke" <Ry...@Sun.COM>
To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
Sent: Monday, October 21, 2002 12:07 PM
Subject: Re: Using rtexprvalue.


> Hi Stefan,
>
> You close tag (c:if) doesn't match the opening tag of (c_rt:if).
>
> Change your close tags to match the opening tags.
>
> <c_rt:if test='<%= rtexpr %>'>
>    Something
> </c_rt:if>
>
> -rl
>
> On Mon, 2002-10-21 at 12:04, Stefan wrote:
> > Hi,
> >
> > I have a problem using rtexprvalue taglibs and some scripting
expressions where some work fine like this one:
> >
> > <fmt_rt:formatDate value="<%= rs.getDate("lastVisitDate") %>"/>
> >
> > and others like :
> >
> >     <c_rt:if test='<%=rs.getString("sex")%>'>
> >      Man
> >     </c:if>
> >
> >     <c_rt:if test='<%=rs.getString("sex")%>'>
> >             Female
> >     </c:if>
> >
> > gives me errors such as:
> >
> > ' expected at end of file. For XML, the top-level tag must have a
matching closing tag
> >
> > I am importing the following two libraries into the pages:
> >
> > <%@ taglib prefix='fmt_rt' uri='http://java.sun.com/jstl/fmt_rt' %>
> > <%@ taglib prefix='c_rt' uri='http://java.sun.com/jstl/core_rt' %>
> >
> > In the above examples the JSTL tags are being used inside a while loop
that is iterating over a rowset provided by a bean method that has made the
database query.
> >
> > Thanks,
> >
> > Stef
> >
> >
> --
> Ryan Lubke <Ry...@Sun.COM>
> Sun Microsystems, Inc.
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Using rtexprvalue.

Posted by Ryan Lubke <Ry...@Sun.COM>.
Hi Stefan,

You close tag (c:if) doesn't match the opening tag of (c_rt:if).

Change your close tags to match the opening tags.

<c_rt:if test='<%= rtexpr %>'>
   Something
</c_rt:if>

-rl

On Mon, 2002-10-21 at 12:04, Stefan wrote:
> Hi,
> 
> I have a problem using rtexprvalue taglibs and some scripting expressions where some work fine like this one:
> 
> <fmt_rt:formatDate value="<%= rs.getDate("lastVisitDate") %>"/>
> 
> and others like :
> 
>     <c_rt:if test='<%=rs.getString("sex")%>'>
>      Man
>     </c:if>
>     
>     <c_rt:if test='<%=rs.getString("sex")%>'> 
>             Female
>     </c:if>
> 
> gives me errors such as:
> 
> ' expected at end of file. For XML, the top-level tag must have a matching closing tag
> 
> I am importing the following two libraries into the pages:
> 
> <%@ taglib prefix='fmt_rt' uri='http://java.sun.com/jstl/fmt_rt' %>
> <%@ taglib prefix='c_rt' uri='http://java.sun.com/jstl/core_rt' %>
> 
> In the above examples the JSTL tags are being used inside a while loop that is iterating over a rowset provided by a bean method that has made the database query.
> 
> Thanks,
> 
> Stef
>   
> 
-- 
Ryan Lubke <Ry...@Sun.COM>
Sun Microsystems, Inc.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


release() methods for jakarta taglibs

Posted by Mike Cantrell <Mi...@ind.alcatel.com>.
We are encountering some problems with the Jakarta Taglibs with newer 
servlet containers that pool the tag objects (Tomcat  4.1.x and JRun 
4.0). Most of the tags I looked through don't override the release() 
method to reset the initial values and do cleanup.

For instance, the mailer taglib has a tag called mt:addrecipient. If you 
use this tag, each time the page is called the value is just appended to 
the original value. Are there any plans to go through these tags and 
make them "pool safe"?

Example:

    <mt:mail server="smtp">
        <mt:from><c:out value="${param.mail_from}" 
escapeXml="false"/></mt:from>
        <mt:subject><c:out value="${param.subject}" 
escapeXml="false"/></mt:subject>
        <c:forEach var="email" items="${emailList}">
            <mt:addrecipient type="to"><c:out value="${email}" 
escapeXml="false"/></mt:setrecipient>
        </c:forEach>
        <mt:message type="html">
            <div style="width: 500px;">
                <c:out value="${param.body}" escapeXml="false"/>
            </div>
        </mt:message>
        <mt:send/>
    </mt:mail>

Let's assume that emailList contains the addresess: jsmith@foo.com and 
johns@bar.com.

The first time the page is processed, the email sends out emails to:

     jsmith@foo.com, johns@bar.com.

If you hit reload, the email sends out to:

     jsmith@foo.com, johns@bar.com, jsmith@foo.com, johns@bar.com

and if you hit reload again, the email sends out to:
     jsmith@foo.com, johns@bar.com, jsmith@foo.com, 
johns@bar.com, jsmith@foo.com,
     johns@bar.com, jsmith@foo.com, johns@bar.com.


I've double checked the emailList  and it only contains the original 2 
elements each time the page reloads. It appears that the taglib is 
simply adding  the list to the old list from the Object obtained from 
the pool since there's no release() method to reset the tag's initial data.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: mt: Mailer Tag Error - mt:setrecipient - Help

Posted by Mike Cantrell <Mi...@ind.alcatel.com>.
FYI, we're having the same issue. I wonder if it's somehow related to 
the tag pooling email I sent earlier.

Patrick Swarts wrote:

>Hello,
>After upgrading from Tomcat 4.0. to  4.1.12, I encountered weird errors with certain mailer tags (mt:).  
>Specifically, the mt:setrecipient tag seems to "hold on to" a value previously set in a seperate session <!>
>In my case, I have a form, which when submitted would also use the mt: tag to send an email to that user, passing them back information they just submitted in their form.
>Here is the example:
><mt:mail server="localhost" from="welcome@ourhost.com"  subject="Welcome">
><mt:setrecipient type="to"><%= (request.getParameter("emailAddr")) %></mt:setrecipient>
><mt:message type="text">
>Welcome!
>Here is a reminder of your username and password to access the forums:
>
>
>Username: <%= (request.getParameter("userName")) %>
>
>Password: <%= (request.getParameter("password")) %>
>
>
> </mt:message>
>    <mt:send/>
></mt:mail>
>
>Once this jsp is called, the "setrecipient" value will stay what it was the first time the jsp is processed.  A seperate user, with a new session, calling the same jsp, will somehow have the orriginal "Setrecipient" value, and would send the email to the wrong address! (thankfully this is being worked out on our dev server). What is interesting is that if I set the recipient to my own account, and include the email paramter in the body of the message, it rights it there properly!
>
>so this works:
>
><mt:mail server="localhost" from="welcome@ourhost.com"  subject="Welcome">
><mt:setrecipient type="to">taglib_pat@yahoo.com</mt:setrecipient>
><mt:message type="text">
>Welcome!
>
>This email was intended for <%= (request.getParameter("emailAddr")) %>
>
>
>Here is a reminder of your username and password to access the forums:
>Username: <%= (request.getParameter("userName")) %>
>
>Password: <%= (request.getParameter("password")) %>
> </mt:message>
>    <mt:send/>
></mt:mail>
>
>So, why can I not seem to populate the "to" for this email dynamicly?  Why does it hold onto that value from the first request of this jsp and not process it properly?
>
>Any help or insight into this would be greatly appreciated,
>
>Thanks in advance,
>
>Patrick Swarts
>
> 
>
>
>
>---------------------------------
>Do you Yahoo!?
>Y! Web Hosting - Let the expert host your web site
>  
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


mt: Mailer Tag Error - mt:setrecipient - Help

Posted by Patrick Swarts <ta...@yahoo.com>.
Hello,
After upgrading from Tomcat 4.0. to  4.1.12, I encountered weird errors with certain mailer tags (mt:).  
Specifically, the mt:setrecipient tag seems to "hold on to" a value previously set in a seperate session <!>
In my case, I have a form, which when submitted would also use the mt: tag to send an email to that user, passing them back information they just submitted in their form.
Here is the example:
<mt:mail server="localhost" from="welcome@ourhost.com"  subject="Welcome">
<mt:setrecipient type="to"><%= (request.getParameter("emailAddr")) %></mt:setrecipient>
<mt:message type="text">
Welcome!
Here is a reminder of your username and password to access the forums:


Username: <%= (request.getParameter("userName")) %>

Password: <%= (request.getParameter("password")) %>


 </mt:message>
    <mt:send/>
</mt:mail>

Once this jsp is called, the "setrecipient" value will stay what it was the first time the jsp is processed.  A seperate user, with a new session, calling the same jsp, will somehow have the orriginal "Setrecipient" value, and would send the email to the wrong address! (thankfully this is being worked out on our dev server). What is interesting is that if I set the recipient to my own account, and include the email paramter in the body of the message, it rights it there properly!

so this works:

<mt:mail server="localhost" from="welcome@ourhost.com"  subject="Welcome">
<mt:setrecipient type="to">taglib_pat@yahoo.com</mt:setrecipient>
<mt:message type="text">
Welcome!

This email was intended for <%= (request.getParameter("emailAddr")) %>


Here is a reminder of your username and password to access the forums:
Username: <%= (request.getParameter("userName")) %>

Password: <%= (request.getParameter("password")) %>
 </mt:message>
    <mt:send/>
</mt:mail>

So, why can I not seem to populate the "to" for this email dynamicly?  Why does it hold onto that value from the first request of this jsp and not process it properly?

Any help or insight into this would be greatly appreciated,

Thanks in advance,

Patrick Swarts

 



---------------------------------
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site