Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Custom Tags

 
Kudret Serin
Ranch Hand
Posts: 167
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I would like to do following;

I have a tag let’s say <ibp:link toPage="...">

I would like to add a new attribute to this tag but I don’t want to edit this tag's class file. So I want to write my own tag by using old one. Let’s say it will be <my:link toPage="..." newAttribute="..."/>

So I want to do something with newAttribute in <my:link> tag, after doing some work I want the same output from <ibp:link/> tag.

Could you please show the way?

I wish I could have explained my situation
Thanks in advance.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35753
412
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kudret,
It sounds like you want one tag (Java file) to call another. What problem are you running into?
 
Surya Kant
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you can do it very easily..Just extend the class.Define one more entry in .tld class which takes extra parameter..And your job is done..
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I know tag attributes doesn't know inheritance. So you need to define all "to-be-inherited" attributes in the tag file as well.
 
Surya Kant
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes they know..because base class's id attribute inherited automatically..
 
Kudret Serin
Ranch Hand
Posts: 167
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Surya Kant wrote:Yes you can do it very easily..Just extend the class.Define one more entry in .tld class which takes extra parameter..And your job is done..


Thanks for your replies,

@Surya
------------------------
Yes this is the first solution that we think, but after discussing it (De-compile the main class after adding some new features in it after save it another name and using it) we think that we can have some problems between de-compiled java class's owner company and our company.

So what i want to do




So i dont want to invent the whell again but i need to do this in legal way..

Any ideas ?

Gr.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Surya Kant wrote:yes they know..because base class's id attribute inherited automatically..

Erm, I mean the TLD files, not the Java classes.
 
Surya Kant
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the late reply.
Follow these steps for your problem
1.Create a class which extends the existing tag class
2.Create entry in the tld file & define the attribute property also
3.In your doEndTag method check for the attribute .If it is true then call supper class's method otherwise continue.

It is a simple case of overriding.Do let me know if you are still not getting what i am telling.
 
Kudret Serin
Ranch Hand
Posts: 167
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Surya Kant wrote:Sorry for the late reply.
Follow these steps for your problem
1.Create a class which extends the existing tag class
2.Create entry in the tld file & define the attribute property also
3.In your doEndTag method check for the attribute .If it is true then call supper class's method otherwise continue.

It is a simple case of overriding.Do let me know if you are still not getting what i am telling.


Ohh thanks, its works ;)

Thank you....
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!