• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Creating a Tag problem ?

 
Sim Kim
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have an existing project which uses Myfaces and JSP . I have a custom Pagination tag in the project which works fine.
The tag is extending the org.apache.myfaces.taglib.core.ViewTag and has doStart and doEnd methods. For this tag there is a tld and which I have included in the jsp :



This is my tag class :


I havent made any other entry in faces-config or made any renderer/component for this tag.

I am trying to create the same tag in SUN JSF RI 1.2 and Facelets . But the tag doesn't seem to work . there is not error thrown but the xhtml file doesnot seem to understand the tag and it displays the tag as it is.

I have extended the com.sun.faces.taglib.jsf_core.ViewTag to create this tag since I am using SUN JSF RI 1.2 .

Do I need to create a Component class and/or a Renderer too . Why it was not required in myfaces case.
 
Tim Holloway
Saloon Keeper
Posts: 18367
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It can be confusing. There are 3 kinds of tags:

1. plain JSP tags
2. JSF tags
3. Facelets tags

Plain JSP tags are well-documented. JSF tags are somewhat more complicated extensions of JSP tags. Facelets tags from what I can tell, are extended JSF tags, except that apparently you can skip some of the JSF tag internal components as long as you're only using the tag in Facelets.

Making things worse is that all the good docs I've seen on custom Facelets tags are for non-graphical tags.

The heart of the problem is graphical rendering. JSP tags do their own rendering. JSF is designed to separate the tag's behavior from its graphical view, so you can plug in more than one type of renderer, though most custom JSF tags are only supplied with an HTML renderkit, since the application designer probably only needs HTML.

Facelets is a little more HTML-oriented than straight JSF, so in some ways its simpler. It also doesn't put much stock in the TLD.

I may be wrong about some of this, since I've yet to see a concise explanation that takes graphical facelets tags into account, but I have successfully implemented one - it's a very handy Google Maps tag.

I'm also about to implement a boolean output-only tag (something that JSF core lacks), so I'll be refreshing my memory. Maybe the added experience will help make it all make sense to me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic