Bug 315892 - In xhtml pages, content assist for elements attributes worksonly for JSF 2 base library.
Summary: In xhtml pages, content assist for elements attributes worksonly for JSF 2 ba...
Status: RESOLVED INVALID
Alias: None
Product: Java Server Faces
Classification: WebTools
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 major with 6 votes (vote)
Target Milestone: 3.3.1   Edit
Assignee: Ian Trimble CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-05 19:23 EDT by Flávio CLA
Modified: 2011-09-08 14:29 EDT (History)
8 users (show)

See Also:


Attachments
First Step ok (27.42 KB, image/png)
2010-06-20 22:50 EDT, Flávio CLA
no flags Details
Second step - content assist for elements attributes - not ok (39.58 KB, image/png)
2010-06-20 22:52 EDT, Flávio CLA
no flags Details
xhtml renamed to jsp to show content assist behavior (230.41 KB, image/png)
2010-06-20 23:15 EDT, Flávio CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Flávio CLA 2010-06-05 19:23:26 EDT
Build Identifier: Build id: 20100603-0907

Helios 3.5 RC3

You can create a simple xhtml filme.

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">
......
<h:outputLabel .... if you press control + space you can see all the attributes like id, for, onblur, etc.

<rich:panel ..... if you press control + space eclipse gives you "not Default Proposal (element rich:panel is unknow).

This happens with icefaces, primefaces.

If you rename the file extension to JSP, the content assist for attributes works again.

I have tested in eclipse 3.5.2 and this behavior also happens with xhtml file, but it´s fine with jsp files. 

Reproducible: Always

Steps to Reproduce:
1.create an xhtml file
2. put your favority JSP extended implementation like richfaces, primefaces, icefaces, whatever
3. try content assist for this elements and eclipse won´t be able to show the elements attributes.
Comment 1 Cameron Bateman CLA 2010-06-07 16:20:39 EDT
Based on the website, RichFaces won't have full support for JSF 2.0 integration.  Specifically, the version 3.0 limitations list says that "RichFaces 3.3.3 does not support JSF 2 built-in facelets (VDL)".

The amount of support you get will also depend on how the taglib.xml files are configured for these libraries.  If they do not encode specific tag information in their files, then there will be no design time support for these tags.
Comment 2 Flávio CLA 2010-06-08 10:40:08 EDT
Well, this missing feature is the worst of all, because it’s almost impossible to remember elements attributes, thus, invalidating the use of the editor. I really don´t want to postpone the use of Java EE 6 support in Eclipse to future versions. We can´t use JBoss Tools, because (don´t ask me why) we are not allowed to.
 
By the way,  I take a look at eclipse configuration at:
 
Preferences – JavaServer Faces Tools – Views – JSP TagRegistry 
I tried to activate the “introspecting tag resolver” but the problem was not resolved. 
 
What is intrigating me is why this feature works with jsp files and not for xhtml files?
Why JSF base taglib displays corrects and others implementations not in xhtml files?
 
I will contact JSF vendors, maybe I am lazy and missing some important information regards configuration. As I told in the past, JSP spoofing in xhtml resolved that problem, but today, the fix for circular dependence no more allows to go that way.
 
When you say "future version", can I expect a service pack for helios to resolve this or this means the next Eclipse 3.7?
Comment 3 Flávio CLA 2010-06-18 12:56:45 EDT
I have tested again with others libraries (Icefaces 2.0 beta, Richfaces 4.0 Alpha2 and PrimeFaces 2.0.3 final) and the problem persists. I have openned the tag library xml files from every distribution and it´s seems to be ok. In primefaces forum, I was told to await for the final release of Helios, so they don´t give me any advice.

(In reply to comment #2)
> Well, this missing feature is the worst of all, because it’s almost impossible
> to remember elements attributes, thus, invalidating the use of the editor. I
> really don´t want to postpone the use of Java EE 6 support in Eclipse to future
> versions. We can´t use JBoss Tools, because (don´t ask me why) we are not
> allowed to.
> By the way,  I take a look at eclipse configuration at:
> Preferences – JavaServer Faces Tools – Views – JSP TagRegistry 
> I tried to activate the “introspecting tag resolver” but the problem was not
> resolved. 
> What is intrigating me is why this feature works with jsp files and not for
> xhtml files?
> Why JSF base taglib displays corrects and others implementations not in xhtml
> files?
> I will contact JSF vendors, maybe I am lazy and missing some important
> information regards configuration. As I told in the past, JSP spoofing in xhtml
> resolved that problem, but today, the fix for circular dependence no more
> allows to go that way.
> When you say "future version", can I expect a service pack for helios to
> resolve this or this means the next Eclipse 3.7?
Comment 4 Raghunathan Srinivasan CLA 2010-06-18 13:31:34 EDT
Thanks, Flavio, for the input on this issue. We will test this out and comment on this bug.
Comment 5 Cameron Bateman CLA 2010-06-18 13:33:58 EDT
(In reply to comment #3)
> I have tested again with others libraries (Icefaces 2.0 beta, Richfaces 4.0
> Alpha2 and PrimeFaces 2.0.3 final) and the problem persists. I have openned the

Are any of these open source?  Can you post to a link to somewhere I could download one of these libs so I can take a look at the taglib.xml's?  My suspicion is that they do not bother to explicitly declare their tags in these files.  In that case, we can't provide help since we don't have the information we need.
Comment 6 Flávio CLA 2010-06-18 22:02:44 EDT
Thank you for the reply :)

Yes, they are all opensource.
You can try that one (JSF 2 ready): 

http://primefaces.googlecode.com/files/primefaces-2.0.2.zip

Inside the jar, the META-INF folder contains:

primefaces-i.taglib.xml
primefaces-p.taglib.xml
primefaces-p.tld
primefaces-i.tld
.....




(In reply to comment #5)
> (In reply to comment #3)
> > I have tested again with others libraries (Icefaces 2.0 beta, Richfaces 4.0
> > Alpha2 and PrimeFaces 2.0.3 final) and the problem persists. I have openned the
> Are any of these open source?  Can you post to a link to somewhere I could
> download one of these libs so I can take a look at the taglib.xml's?  My
> suspicion is that they do not bother to explicitly declare their tags in these
> files.  In that case, we can't provide help since we don't have the information
> we need.
Comment 7 Flávio CLA 2010-06-18 22:28:02 EDT
1 - Put Primefaces and JSF 2 library in the buildpath.
2 - create a XHTML file
3 - try to use content assistent for f, h, ui and p. (will not work)
4 - rename the same xhtml to jsp file. The content assist for namespace and elements attributes works fine.

test.xhtml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head></h:head>
<h:body>
	<h:form>
            ... TRY CONTENT ASSISTENT HERE
	</h:form> 
</h:body> 
</html>
Comment 8 Flávio CLA 2010-06-20 22:50:35 EDT
Created attachment 172300 [details]
First Step ok

This is the first step to test content assist with JSF 2 vendor library.
This step is ok, the problem is for element attributes. See the next picture.
Comment 9 Flávio CLA 2010-06-20 22:52:38 EDT
Created attachment 172301 [details]
Second step - content assist for elements attributes - not ok

This is where the problem rises. You can´t see content assist for any element attribute.
Comment 10 Flávio CLA 2010-06-20 22:54:44 EDT
Hi, here two screenshot to illustrate the problem. The library used was Primefaces 2.0.2, but this problem also happens with Icefaces and Richfaces libraries.

I hope this helps anyway.
Comment 11 Flávio CLA 2010-06-20 23:15:07 EDT
Created attachment 172302 [details]
xhtml renamed to jsp to show content assist behavior

This is an xhtml file renamed to JSP. When you edit the file, the content assist works.
Comment 12 Yury Kats CLA 2010-06-21 15:08:27 EDT
My guess would be that those facelet taglibs contain no information about the attributes. Only a list of tags/components.
When you switch into JSP, a TLD file is used instead of the facelet taglib.xml, and TLDs do contain attribute information.
Comment 13 Ralph Soika CLA 2010-06-21 16:33:22 EDT
I made a similar posting (see Bug [314098])
And I agree with Flávio that there seems to be something wrong when using xhtml files.

why is it problematic to accept also .xhtml files for the JSF content assist. For my understanding .xhtml files should have the same behavior like the .jsp files in a JEE Project.
I am working with RichFaces - this is a common jsf library from JBoss.
And I have problems with galileo. And as you can see in my blog post (describing a workaround)  there are people who have the problem too.

http://www-02.imixs.com/roller/ralphsjavablog/entry/eclipse_galileo_jsf_content_assist
Comment 14 Yury Kats CLA 2010-06-21 16:43:32 EDT
I think what problematic is that library authors do not put any attributes information into taglib.xml file. It's not required for Facelets runtime to run the page, but the current tooling implementation has no means of finding what attributes a particular tag has.
Comment 15 Cameron Bateman CLA 2010-06-21 16:51:26 EDT
(In reply to comment #14)
> I think what problematic is that library authors do not put any attributes
> information into taglib.xml file. It's not required for Facelets runtime to 
> run the page, but the current tooling implementation has no means of finding 
> what attributes a particular tag has.

Correct.  If you look at prime faces as an example, here's an example of a tag definition for the accordian panel:

<tag>
<tag-name>accordionPanel</tag-name>
   <component>
    <component-type>org.primefaces.component.AccordionPanel</component-type>
    <renderer-type>org.primefaces.component.AccordionPanelRenderer</renderer-type>
   </component>
</tag>

So they have not provided us any information about the attributes.  Compare this to the tag libs that are provided for the built-in h:outputText tag:

<tag>
        <!-- snip description for clarity -->
        <tag-name>outputText</tag-name>
        <component>
            <component-type>javax.faces.HtmlOutputText</component-type>
            <renderer-type>javax.faces.Text</renderer-type>
        </component>
        <attribute>
            <description>
                Converter instance registered with this component.
            </description>
            <name>converter</name>
            <required>false</required>
            <type>javax.faces.convert.Converter</type>
        </attribute>
        <attribute>
            <description>
                The component identifier for this component. This value must be
                unique within the closest parent component that is a naming
                container.
            </description>
            <name>id</name>
            <required>false</required>
            <type>java.lang.String</type>
        </attribute>
    <!-- snip remaining attributes for clarity -->
    </tag>
Comment 16 Flávio CLA 2010-06-21 18:53:52 EDT
Thanks!

This leads me to think that Primefaces and others JSF vendors are relying in some IDE voodoo magic to show element attributes for missing information in their tag definition (probably accessing missing information in JSP taglib). 

I don’t think is fair to ask for Eclipse Team to make such a thing.
JBoss Tools and Netbeans are able to handle this problem, but I think that is the responsibility of the developer to guarantee library compatibility across IDE´s, since we are talking about specification.

I will wait for Helios final release (it´s near!!!) to gentle ask JSF vendors for the completion of their taglib declaration. I also understand their position (I’m wondering), because it’s easy to main attribute information in one file then two.  

Since “JSP spoofing” for XHTML don’t work anymore in Helios, maybe this will be forcing JSF vendors do fix this issue in their taglibs, meanwhile, a lot of people like me will have to face this problem alone. 

Thanks again!
Comment 17 Flávio CLA 2010-06-22 07:37:39 EDT
This is the answer I received in Primefaces Forum, when I asked for taglib completion:

Re: primefaces-p.taglib.xml missing attribute declaration
by Oleg » Tue Jun 22, 2010 9:04 am 

Hello.

It's not nessesary because attributes should be extracted via Java reflection (according to the spec.). Sadly, but there isn't really good IDE that does it completely  The code autocompletion is due to TLDs (in classpath) at the moment.PrimeFaces 2.0.2, Mojarra 2.0.2, JBoss 5.1.x, Weblogic 10.x, GlassFish v2/v3Oleg 
  
Posts: 685
Joined: Fri Oct 02, 2009 7:41 am
Location: Russia, Siberia => Germany, Black Forest 

Source http://primefaces.prime.com.tr/forum/viewtopic.php?f=3&t=2887
Comment 18 Yury Kats CLA 2010-06-22 10:52:44 EDT
It's not technically necessary, but it will go a long way towards making it easier for IDEs to support JSF2 libraries.

Both files, taglib.xml and TLD, are most likely automatically generated during libraries build process. It shouldn't be too hard for library vendor to augment taglib.xml with attributes. There is no maintenance cost associated with that, just one extra generation step during the build/packaging.
Comment 19 Cameron Bateman CLA 2010-06-22 11:01:23 EDT
> It's not nessesary because attributes should be extracted via Java reflection
> (according to the spec.). Sadly, but there isn't really good IDE that does it

We have tried this in the past and had mixed results.  Performance can become an issue if the number of tags is large.  Note that is also possible to only specify a tag factory (not even the tags), in which case it is even more difficult to extract that information.  

In the future we will probably provide an extension through which additional information about tags can be contributed by adopters or end-users.  We have a metadata framework that does this for other information but we couldn't use it in this release for that purpose because it would create a circular dependency.
Comment 20 Flávio CLA 2010-06-23 10:35:06 EDT
Despite this "problem", I am happy with Eclipse 3.6 (Java EE 6).
As I can see, the next 3.7 release will polish even more the IDE.
Thanks you guys!
Comment 21 Raghunathan Srinivasan CLA 2010-06-23 13:02:47 EDT
(In reply to comment #20)
> Despite this "problem", I am happy with Eclipse 3.6 (Java EE 6).
> As I can see, the next 3.7 release will polish even more the IDE.
> Thanks you guys!

Appreciate your feedback and thanks for your participation.
Comment 22 ethermion CLA 2010-08-25 19:58:01 EDT
I think Eclipse is the cat's meow, but using Primefaces with Eclipse is a litter box without content assist.

I assume that getting Primefaces to fill in the taglib descriptor is the shortest path to solving this problem.  To that end, a bug has been opened, which Mr. Primefaces suggests will be addressed if it can get enough votes.

http://code.google.com/p/primefaces/issues/detail?id=1176

Looks like a half dozen votes will get it on the radar.  Go get 'em.  Make me happy.
Comment 23 Ajami CLA 2010-09-05 19:36:30 EDT
(In reply to comment #22)
> I think Eclipse is the cat's meow, but using Primefaces with Eclipse is a
> litter box without content assist.
> 
> I assume that getting Primefaces to fill in the taglib descriptor is the
> shortest path to solving this problem.  To that end, a bug has been opened,
> which Mr. Primefaces suggests will be addressed if it can get enough votes.
> 
> http://code.google.com/p/primefaces/issues/detail?id=1176
> 
> Looks like a half dozen votes will get it on the radar.  Go get 'em.  Make me
> happy.

Here:
http://cagataycivici.wordpress.com/2010/08/31/primefaces-support-in-eclipse-helios/

They have added the metadata to the taglib, it's working now
Comment 24 Flávio CLA 2010-09-23 19:51:22 EDT
Today, no IDE has the hability to scan for @ManagedBean.

JBoss Tools "doesn´t" like @ManagedBean, so they only scan por @Named (CDI replacement for JSF managedBeans),

It would be very nice to have annotation scanning for @ManagedBean in Eclipse.

Can we expect this in the next release? 

If the performance is a problem, maybe we could configure in the project the packages to scan for annotation types. I known this is not the best solution, but helps a lot.

If the answer is positive, I am ready to start testing as soon as possible :)
Comment 25 Yury Kats CLA 2010-09-23 20:03:45 EDT
> Today, no IDE has the hability to scan for @ManagedBean.

Not quite true. RAD supports @ManagedBean annotations.
Comment 26 Raghunathan Srinivasan CLA 2010-09-24 18:28:59 EDT
(In reply to comment #24)
> Today, no IDE has the hability to scan for @ManagedBean.
> 
> JBoss Tools "doesn´t" like @ManagedBean, so they only scan por @Named (CDI
> replacement for JSF managedBeans),
> 
> It would be very nice to have annotation scanning for @ManagedBean in Eclipse.
> 
> Can we expect this in the next release? 
> 
> If the performance is a problem, maybe we could configure in the project the
> packages to scan for annotation types. I known this is not the best solution,
> but helps a lot.
> 
> If the answer is positive, I am ready to start testing as soon as possible :)

This is under consideration for the Indigo release. We will confirm in the M3 timeframe. Thanks for your interest and volunteering to test the feature.
Comment 27 Fred Kastl CLA 2011-04-06 09:24:43 EDT
I'am working with 3.6. When i open my file the testfile.xhtml using "Open With" -> "JSP Editor": autompletion is not working. If I rename the same file to testfile.jsp and open it also with "Open With" -> "JSP Editor": autocompletion works. Why did the editor get the information when the file has the jsp extension?
If i open the same workspace with Eclipse 3.5.2.R35x it works in both cases.


See also (Open xhtml files with JSP editor): http://www.mojavelinux.com/blog/archives/2006/12/facelets_tag_completion_in_eclipse/
Comment 28 Ian Trimble CLA 2011-04-06 13:11:42 EDT
See comment #12 by Yury. When you are editing an XHTML file, the source of truth about tags and attributes is a *.taglib.xml file, when you start editing a JSP, the source of truth is a TLD. Please check your library's tag descriptors to see if the attributes are listed only in the TLD - if this is the case, then this is why you are experiencing this.
Comment 29 Ralph Soika CLA 2011-04-09 06:42:55 EDT
I have also the same problem with .xhtml files. 
It was a problem in eclipse 3.5 and many people wrote blogs how to fix this by adding the right content type for xhtml files.
Now with Eclipse 3.6 the same problem again. And it seems to me that the normal workarounds did not work.
I don't think that we all are trying to develop exotic web projects? In my case I am working on a maven based JEE6 Project using m2Plugin, RichRaces and running on Glassfish. I think this is an typical szenario for many JEE developers.

JSF/Faclet Pages named *.xhtml did not support code completion in Eclipse 3.6. Renaming the file in *.jsp code completion works.

What should we do to tell Eclipse handling .xhtml files like .jsp files?
Pleas do not tell us that we have to check the tag descriptors in our libraries. There must be a trick to tell Eclipse that a .xhml file is the same as a *.jsp file!
Comment 30 Walter Mourão CLA 2011-08-05 08:59:50 EDT
>>What should we do to tell Eclipse handling .xhtml files like .jsp files?

Folks, is it possible ? at first sight it looks like a configuration thing...
It is really important...

Thanks,
Comment 31 Raghunathan Srinivasan CLA 2011-08-05 11:58:15 EDT
(In reply to comment #30)
> >>What should we do to tell Eclipse handling .xhtml files like .jsp files?
> 
> Folks, is it possible ? at first sight it looks like a configuration thing...
> It is really important...
> 
> Thanks,
For Juno, we will investigate a mechanism for using information from TLD as a fallback mechanism. See comment 19.
Comment 32 Ian Trimble CLA 2011-08-29 19:26:48 EDT
It has been explained several times in this bug report why there is a difference. When dealing with JSF 2.0 and *.taglib.xml descriptors, a different mechanism is used to determine the available attributes. If the author of such a library has not provided the attribute information, it is not correct to assume that any available TLD is appropriate to describe the tag library - there could be good reason that a TLD and *.taglib.xml files describe different attributes and it would be wrong for us to assume these two descriptor methods are interchangeable.

That said, there is no simple solution that can address this anyway; a factory has been chosen to provide the content model before element information is requested. There is no way to determine the validity of a factory based on what arbitrary attribute information it is provided. That is, the factory can not be determined to be invalid at the point where the factory is registered, and when the factory is asked to provide element information, it is too late to "swap in" another factory based on some heuristic that decides which is more appropriate.

PrimeFaces 2.2.1 and RichFaces 4.0.0 now have attribute definitions in their *.taglib.xml descriptors; I doubt this was done for the fun of it, the definitions should have been there all along and the authors have rectified the problem. I believe this to be the correct resolution for this issue; library authors need to provide the expected attribute definitions with their libraries.
Comment 33 Raghunathan Srinivasan CLA 2011-09-08 14:29:37 EDT
Closing this bug. Please reopen if there are other suggestions that we should consider.