This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JSP and the fly likes Extending tags etc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSP
Reply locked New topic

Extending tags etc

Chris Lynx

Joined: Jul 26, 2007
Posts: 4
Not sure if this is the right place - I have also posted in JSF, but think its kinda between both lists...

I have just started looking at JSF/JSP etc and am not sure if I am going down the right track with regards to extending the core JSF components.

This is what I have done:

1) I have extended javax.faces.component.html.HtmlCommandButton
2) I have extended com.sun.faces.taglib.html_basic.CommandButtonTag
3) I have registered my extended HtmlCommandButton in faces-config.xml
4) I have created a .tld file which has a tag pointing to my extended CommandButtonTag.

The problem I have is that when i import my taglib into a jsp I dont get any attributes?

Eg if I add an attribute "myAttribute" to my taglib I can reference it from my jsp. However, as my taglib points to my implementation of com.sun.faces.taglib.html_basic.CommandButtonTag I was expecting to be able to get all the attributes associated with it in my jsp.

Therefore I was expecting to be able to do something like:

<myTagLib:myCommandButton value="Test"></myTagLib:myCommandButton>

However, I can not see the value attribute.

Any ideas? Have I gone about JSF component extension in the wrong way?
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63349

Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Extending tags etc
It's not a secret anymore!