History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEA-16563
Type: Bug Bug
Status: Open Open
Assignee: Dmitry Avdeev
Reporter: Mike Hanafey
Votes: 1
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
IDEA: Feedback

JSF Facelets Functions defined in "facelets.taglib.xml" should be supported

Created: 29 Nov 07 20:48   Updated: 03 Dec 07 17:20
Component/s: J2EE.JSF

Build: 7,361
Severity: Medium


 Description  « Hide
Facelets makes is trivial to define EL functions:
my.taglib.xml
<facelet-taglib xmlns="http://java.sun.com/JSF/Facelet">
    <namespace>http://genomix.es.dupont.com/faces/trak</namespace>
    <function>
        <function-name>stackTrace</function-name>
        <function-class>genomix.tractor.backing.FaceletFunctions</function-class>
        <function-signature>java.lang.String stackTrace(java.lang.Exception)</function-signature>
    </function>
</facelet-taglib>

With this defined, the following EL as an example should be a first class expression with full support for completion and error highlighting:

#{trak:stackTrace(requestScope["javax.servlet.error.exception"])}


 All   Comments   Work Log   Change History      Sort Order:
Maxim Mossienko - 29 Nov 07 20:58
Please, add doctype definition for function recognition

<!DOCTYPE facelet-taglib PUBLIC
"-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
"http://java.sun.com/dtd/facelet-taglib_1_0.dtd">


Maxim Mossienko - 29 Nov 07 21:08
Weird, your taglib should be recognized as is given the client code has JSPX filetype

Maxim Mossienko - 29 Nov 07 21:49
The taglib should be under WEB-INF, is it the case?

Mike Hanafey - 29 Nov 07 22:12
The problem is caused because I have a companion "my.tld" file as well. When this file was removed the facelets EL function became known to IDEA.

The "my.tld" file was added because it makes IDEA clever regarding tags defined in the "my.taglib.xml". The example I attached before was abbreviated.

my.taglib.xml
<!DOCTYPE facelet-taglib PUBLIC
  "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
  "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
<facelet-taglib xmlns="http://java.sun.com/JSF/Facelet">
    <namespace>http://genomix.es.dupont.com/faces/trak</namespace>

    <tag>
        <tag-name>nameAjax</tag-name>
        <source>nameAjaxTag.xhtml</source>
    </tag>

    <function>
        <function-name>stackTrace</function-name>
        <function-class>genomix.tractor.backing.FaceletFunctions</function-class>
        <function-signature>java.lang.String stackTrace(java.lang.Exception)</function-signature>
    </function>

</facelet-taglib>

With only this file defined, a facelets reference like the following:

snippet
<trak:nameAjax id="suser" nameAjax="#{newLead.suserAjax}"/>

puts all the burden on the user to know what the attributes are, and which are required, etc.

This is fixed by adding the "my.tld", as follows:

my.tld
<?xml version="1.0" encoding="ISO-8859-1" ?>
<taglib xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
        version="2.1">

    <description>
        Tags useful in the Lead Tracking application
    </description>
    <tlib-version>1.2</tlib-version>
    <short-name>trak</short-name>
    <uri>http://genomix.es.dupont.com/faces/trak</uri>

    <tag>
        <description>
            <![CDATA[Tags for picking a Sybase user by typing a few letters of the name. ]]>
        </description>
        <name>nameAjax</name>
        <tag-class>java.lang.Object</tag-class>
        <body-content>empty</body-content>
        <attribute>
            <description>An prefix to attach to ids to make them unique in a faces view.</description>
            <name>id</name>
            <required>true</required>
            <deferred-method>
                <method-signature>java.lang.String getId()</method-signature>
            </deferred-method>
        </attribute>
        <attribute>
            <description>What to rerender on change in picklist.</description>
            <name>reRender</name>
            <required>false</required>
            <deferred-method>
                <method-signature>java.lang.String getReRenderList()</method-signature>
            </deferred-method>
        </attribute>
        <attribute>
            <description>Required state on the select list. Default is true</description>
            <name>required</name>
            <required>false</required>
            <deferred-method>
                <method-signature>java.lang.Boolean isRequired()</method-signature>
            </deferred-method>
        </attribute>
        <attribute>
            <description>The NameAjax bean that drives the component</description>
            <name>nameAjax</name>
            <required>true</required>
            <deferred-method>
                <method-signature>genomix.tractor.backing.NameAjax method()</method-signature>
            </deferred-method>
        </attribute>
    </tag>

</taglib>

The tag has a bogus implementation of "java.lang.Object" because it is not supposed to be used with a JSP view handler. But what it does very nicely is make the tag come alive in IDEA with documentation and completion.

Until facelets is updated to allow more information to be put in the definition file, this hack is extremely useful, so it would be very nice if IDEA would combine the information from both the xml and tld files.

Related issues: http://www.jetbrains.net/jira/browse/IDEADEV-21388 http://www.jetbrains.net/jira/browse/IDEA-16382


Maxim Mossienko - 29 Nov 07 22:17
I bet you can update "companion" tld file to contain 'function' too. We plan to have better Seam support in Diana

Mike Hanafey - 03 Dec 07 17:20
Thanks – you win the bet, the function can be defined in the tld. The issue raised in http://www.jetbrains.net/jira/browse/IDEA-16382 does however remain an issue...