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 luca <pa...@eunet.no> on 2004/11/29 23:52:13 UTC

one class implementing many tags

Hallo,

here is my big problem today. I want to implement 6 tags
h1,h2,....,h6 for a tag-lib I have developed.

I might of course create 6 classes, but since the classes
would be almonst identical, I was wondering if there was
a way to just have one class (possibly with 6 entries in the TLD file
all pointing to the same class).

For example, if only a Class that implements TagSupport
could know the name of the tag it is being imvoked as,
I could easily achieve this objective:

if (this.tagName().substring("4") != -1) ...

am I totally off track?

the reason why I need to do it with names is that my tag-lib
is supposed to look as much as possible as HTML to be easy to
learn and use.

thanks

Luca



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


Re: one class implementing many tags

Posted by Felipe Leme <ja...@felipeal.net>.
Another option would be passing the level as an argument. Something like
this:

<html:h level="1" msg="xxx"/>

-- Felipe


On Mon, 2004-11-29 at 21:22, Rahul P Akolkar wrote:
> I'm not sure why you want just one class, it seems you can just have a 
> Utils/Helper class that the 6 tag impl classes rely on to do all the work.
> 



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


Re: one class implementing many tags

Posted by luca <pa...@eunet.no>.
you were right. The six classes boiled down to something
as simple as:

public class WallH2 extends HeadingHelper {

     public WallH2 () {
	super.level = "2";
     }
}

thanks

Luca


Rahul P Akolkar wrote:

> luca wrote:
> 
> 
>>are you saying 6 simple classes + a complicated one?
> 
> 
> Yes.
> 
> 
>>That would work. Just wanted to keep the number of classes down.
> 
> 
> Sorry, can't think of a way to do that. From a code maintenance point of 
> view, its probably six of these and half a dozen of the other. As an 
> up-side, you might actually end up with a cleaner looking impl.
> 
> -Rahul
> 


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


RE: include and internet explorer

Posted by Thierno Ba <la...@hotmail.com>.
Hi all,

I have figure out my problem already.  It turns out I did not exclude
the HTML, HEAD, TITLE, and BODY tags from my included pages... Could not
blame Microsoft on this one! :)

Thierno.

Tel-USA: (321) 206-0323
Cell-USA: (321) 356-8022

-----Original Message-----
From: Thierno Ba [mailto:lamine75@hotmail.com] 
Sent: Tuesday, November 30, 2004 10:41 AM
To: 'Tag Libraries Users List'
Subject: jsp:include and internet explorer

Hi all,

I use <jsp:include> in one of my pages in order to include dynamically
JSP pages.  Surprisingly, the pages work fine on Netscape and Firefox,
but not on Internet Explorer (why am I not surprised!).

Has anyone dealt with this kind of issue and already know the magic key
for IE?

Thierno.

-----Original Message-----
From: Rahul P Akolkar [mailto:akolkar@us.ibm.com] 
Sent: Monday, November 29, 2004 7:07 PM
To: Tag Libraries Users List
Subject: Re: one class implementing many tags

luca wrote:

> are you saying 6 simple classes + a complicated one?

Yes.

> That would work. Just wanted to keep the number of classes down.

Sorry, can't think of a way to do that. From a code maintenance point of

view, its probably six of these and half a dozen of the other. As an 
up-side, you might actually end up with a cleaner looking impl.

-Rahul

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


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


jsp:include and internet explorer

Posted by Thierno Ba <la...@hotmail.com>.
Hi all,

I use <jsp:include> in one of my pages in order to include dynamically
JSP pages.  Surprisingly, the pages work fine on Netscape and Firefox,
but not on Internet Explorer (why am I not surprised!).

Has anyone dealt with this kind of issue and already know the magic key
for IE?

Thierno.

-----Original Message-----
From: Rahul P Akolkar [mailto:akolkar@us.ibm.com] 
Sent: Monday, November 29, 2004 7:07 PM
To: Tag Libraries Users List
Subject: Re: one class implementing many tags

luca wrote:

> are you saying 6 simple classes + a complicated one?

Yes.

> That would work. Just wanted to keep the number of classes down.

Sorry, can't think of a way to do that. From a code maintenance point of

view, its probably six of these and half a dozen of the other. As an 
up-side, you might actually end up with a cleaner looking impl.

-Rahul

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


Re: one class implementing many tags

Posted by Rahul P Akolkar <ak...@us.ibm.com>.
luca wrote:

> are you saying 6 simple classes + a complicated one?

Yes.

> That would work. Just wanted to keep the number of classes down.

Sorry, can't think of a way to do that. From a code maintenance point of 
view, its probably six of these and half a dozen of the other. As an 
up-side, you might actually end up with a cleaner looking impl.

-Rahul

Re: one class implementing many tags

Posted by luca <pa...@eunet.no>.

Rahul P Akolkar wrote:

> I'm not sure why you want just one class, it seems you can just have a 
> Utils/Helper class that the 6 tag impl classes rely on to do all the work.

are you saying 6 simple classes + a complicated one?

That would work. Just wanted to keep the number of classes down.

Luca



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


Re: one class implementing many tags

Posted by Rahul P Akolkar <ak...@us.ibm.com>.
luca wrote:

> I might of course create 6 classes, but since the classes
> would be almonst identical, I was wondering if there was
> a way to just have one class (possibly with 6 entries in the TLD file
> all pointing to the same class).

I'm not sure why you want just one class, it seems you can just have a 
Utils/Helper class that the 6 tag impl classes rely on to do all the work.

-Rahul