• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Custom Tags

 
Ranch Hand
Posts: 167
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 42056
926
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kudret,
It sounds like you want one tag (Java file) to call another. What problem are you running into?
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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....
 
And then we all jump out and yell "surprise! we got you this tiny ad!"
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic