aspose file tools*
The moose likes JSF and the fly likes JSF Custom Component - Facelets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF Custom Component - Facelets" Watch "JSF Custom Component - Facelets" New topic
Author

JSF Custom Component - Facelets

Adolfo Eloy
Ranch Hand

Joined: Mar 21, 2009
Posts: 146

Hello all.

I've developed a JSF custom component (JSF 1.2), and it works normally within JSP pages.
So, when I try do use my component in a Web Application with Facelets, I cannot declare my namespace component
inside XHTML. Normally, with other components (i.e. tomahawk), the namespaces are recognized inside Eclipse editor
and the code assist helps us to autocomplete the URI.

Does anybody already have the same problem?

Thanks.


Adolfo Eloy
Software Developer
OCPJP 6
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

I'm not sure how much of what you're complaint is is about Eclipse and how much is about JSF.

Facelets requires a somewhat different method of declaration for JSF component properties and methods than what you do in straight JSF or JSP. If you don't provide this declaration file, you'll have problems rendering the page.

Eclipse auto-complete needs XML schema information if it's going to be able to provide code assist to people using the editor. But that's an entirely different bucket of worms.


Customer surveys are for companies who didn't pay proper attention to begin with.
Adolfo Eloy
Ranch Hand

Joined: Mar 21, 2009
Posts: 146

Thank you Holloway for the answer.

I've downloaded the tomahawk source code to inspect how it was made to work in facelets projects.
So I didn't find such a schema to be used by my IDE.
The only thing I found different there was a file tomahawk.taglib.xml which I tried to create something like it inside my project.
But I have no success.

Could you tell me where to find related documents which can help me to write JSF Component that are Facelets complaint?

Thanks.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

The taglib.xml file is what you need. I'd have to Google for information on it, though, since I don't remember where I found the docs on setting one up.
suresh dasari
Ranch Hand

Joined: Oct 05, 2009
Posts: 121

for the custom components you need both <name>taglib.xml file and <name>.tld file which you should store in META-INF folder.
for the third party libraries like myfaces or tomhawk you should redeclare them in <name>taglib.xml file which again should be stored in META-INF folder.(tld files will be already present so no need of tlds again in META-INF folder)
Facelets will directly look into the META-INF directory for the definations of unkown tags.

Sun Certified Java Programmer with 93 percent
Adolfo Eloy
Ranch Hand

Joined: Mar 21, 2009
Posts: 146

Tim Holloway wrote:The taglib.xml file is what you need. I'd have to Google for information on it, though, since I don't remember where I found the docs on setting one up.


I found the documents about taglib.xml on https://facelets.dev.java.net/nonav/docs/dev/docbook.html#taglib

suresh dasari wrote:for the custom components you need both <name>taglib.xml file and <name>.tld file which you should store in META-INF folder.
for the third party libraries like myfaces or tomhawk you should redeclare them in <name>taglib.xml file which again should be stored in META-INF folder.(tld files will be already present so no need of tlds again in META-INF folder)
Facelets will directly look into the META-INF directory for the definations of unkown tags.


Suresh, it was exactly what I was needing to do:
- use the same name for <name>.tld and <name>taglib.xml when declaring my integration tag files.
- placing only the taglib.xml into META-INF.

To facilitate the using and right generation of my component I'm currently using Maven Archetypes for JSF Custom Component.


Tim Holloway and Suresh Dasari,
Thanks for help!

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF Custom Component - Facelets