jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vianen, Jeroen van" <jeroen.van.via...@satama.com>
Subject RE: New JSP 2.0 mailer taglib
Date Thu, 22 Apr 2004 20:10:55 GMT
Hi Felipe,

I tried to come up with a solution for this problem and it can be found at
http://www.vanvianen.nl/mailer2/JSP20to12.java. It is a little app that will
read the taglib's TLD and JAR file and create JSP 1.2 compatible versions of
the tags it finds.

Every attribute found in the tag gets a new setter that stores the EL
expression. In doStartTag() code is added to evaluate the EL attributes and
store the result using the normal setters found in the (original) super
class. All Tags are stored in a separate package.

I ran it with:

java -classpath build;jsdk-24.jar;xercesImpl.jar;mail.jar;mailer2.jar
JSP20to12 -d out mailer2.tld

Example output of this app for one of my tags is:

package org.apache.taglibs.mailer2.tags_12;

import javax.servlet.jsp.JspException;
import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;

public class HeaderTag extends org.apache.taglibs.mailer2.tags.HeaderTag {

  private String name_12 = null;
  public void setName(String name_12) {
    this.name_12 = name_12;

  private String value_12 = null;
  public void setValue(String value_12) {
    this.value_12 = value_12;

  public int doStartTag() throws JspException {
    try {
      if (name_12 != null) {
ExpressionEvaluatorManager.evaluate("name", name_12, java.lang.String.class,
this, pageContext)));
    } catch (ClassCastException ex) {
      /* Ignore */
    try {
      if (value_12 != null) {
ExpressionEvaluatorManager.evaluate("value", value_12,
java.lang.String.class, this, pageContext)));
    } catch (ClassCastException ex) {
      /* Ignore */
    return super.doStartTag();

Next, I did the following:
- created a new mailer2 JAR containing both the 2.0 and 1.2 versions of
those tags
- created a 1.2 version of my TLD
- added JSTL 1.0.5's standard.jar to WEB-INF/lib
- updated the example files to use JSTL 1.0 instead of JSTL 1.1

And it worked!

It only got some light testing and running it requires a lot of manual
intervention, but it might be a good start.



> -----Original Message-----
> From: Felipe Leme [mailto:jakartalists1@felipeal.net] 
> Sent: Wednesday, April 21, 2004 21:11
> To: Tag Libraries Developers List
> Subject: Re: New JSP 2.0 mailer taglib
> Hi Jeroen,
> On Wed, 2004-04-21 at 07:24, Vianen, Jeroen van wrote:
> > Please have a look and let me know what you think of it, 
> especially what
> > aditional features you would like to see and what bugs you 
> encounter. 
> I won't have time to analyze it in the next days, but I have no
> objection on moving it to the sandbox (as much as we explain the
> situation).
> > I would like it to become the new JSP 2.0 version of the 
> mailer taglib and
> > therefore become a part of the taglib sandbox.
> Regarding future plans, we had some discussions a couple of weeks ago
> about creating a generic framework that would make it easier to create
> taglibs for both EL and JSP 2.0 versions. 
> We cannot deliver JSP 2.0 only taglibs, as many people/projets depends
> on JSP 1.2. We could fork mailer (or any other taglig) to have 2
> versions (JSP 1.2 or 2.0), but that would be a nightmare to maintain.
> So, we need a better/clever solution....
> I've been thinking in such a solution for a while, but haven't got the
> time to test it and express the schema in words/diagrams. I 
> will try to
> do something over this weekend (or most likely the next one) and send
> the results to the list.
> Regards,
> Felipe
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org

To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org

View raw message