facebook

Autocompletion for jsp´s (jsp 2.0)

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #251222 Reply

    Jan-Eric Myhrgren
    Participant

    Hi

    The autocompletion feature works great with my taglib based on the JSP 2.0 spec except for one thing, I cant get context help on my tag variables from my <description> (in the taglib) tags in jsp pages.
    I use a nifty app called taglibgenerator that generates documentation for my taglibs and it can generate “everything” + I dont get any validation errors of anykind so I guess my taglib is ok ..

    I get the variables when I use ctrl+space but no context help/variable.
    Code based on my taglib:

    <taglib version="2.0" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd">
        <tlib-version>1.1</tlib-version>
        <jsp-version>2.0</jsp-version>
        <short-name>model</short-name>
        <uri></uri>
        <description>Some description about the lib</description>
        
        <tag>
            <name>aTag</name>
            <display-name>some tag</display-name>
            <tag-class>path.to.some.Tag</tag-class>
            <body-content>JSP</body-content>
            <description>Some description about the tag</description>
            <example>a good example</example>
    
            <attribute>
                <name>value</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Some description</description>
            </attribute>

    etc…

    so the question is, is this supported at all in myeclipse ? if not will it be supported in future relases?

    I use:

    winxp

    java 1.4.04

    myeclipse
    Version: 4.1.0
    Build id: 20060122-4.1-GA

    Eclipse SDK
    Version: 3.1.2
    Build id: M20060118-1600

    #251247

    Riyad Kalla
    Member

    You mean you want the description to popup in the documentation popup when you autocomplete the tag right, so it shows what the tag does?

    Can you post your entire TLD for me, I just pasted in what you have above, and completed the tag and taglib tags, and it was invalid, your schemaLocation is wrong, so I added another URI to it and the file doesn’t validate, it has 3 errors.

    #251293

    Jan-Eric Myhrgren
    Participant

    here is the complete tld file:

    
    <taglib version="2.0" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd">
        <tlib-version>2.0 BETA1</tlib-version>
        <short-name>model</short-name>
        <uri></uri>
        <description>Model Tags</description>
    
        <tag>
            <name>field</name>
            <display-name>model:field</display-name>
            <tag-class>se.abalon.tag.model.BofTag</tag-class>
            <body-content>JSP</body-content>
            <description>A tag capable of rendering most types of output fields for model values</description>
            <example>
                <![CDATA[<model:field value="${flow.doneModel.DESC}" />]]>
            </example>
            <attribute>
                <name>value</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
                <description>The context key for value to display.</description>
            </attribute>
            <attribute>
                <name>format</name>
                <required>false</required>
                <rtexprvalue>false</rtexprvalue>
                <description>The name of the format to use.</description>
            </attribute>
            <attribute>
                <name>locale</name>
                <required>false</required>
                <rtexprvalue>false</rtexprvalue>
                <description>An overloaded Locale. If value is not set, default locale will be used.</description>
            </attribute>
            <attribute>
                <name>mode</name>
                <required>false</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Overload which mode to use for rendering. Valid values are query, text, input</description>
            </attribute>
            <attribute>
                <name>template</name>
                <required>false</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Name of the HTML template to use. Corresponds to property.</description>
            </attribute>
        </tag>
    
        <tag>
            <name>fieldConfig</name>
            <display-name>model:fieldConfig</display-name>
            <tag-class>se.abalon.tag.bof.ConfigTag</tag-class>
            <body-content>JSP</body-content>
            <description>Hold "global" configurations for child tags (for example model:field)</description>
            <example>
                <![CDATA[<model:fieldConfig model="${request.model}" mode="INPUT" template="rowwithlabel">]]>
            </example>
            <attribute>
                <name>format</name>
                <required>false</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Global variable for the value named 'format'</description>
            </attribute>
            <attribute>
                <name>mode</name>
                <required>false</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Global variable for the value named 'mode'</description>
            </attribute>
            <attribute>
                <name>template</name>
                <required>false</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Global variable for the value named 'template'</description>
            </attribute>
            <attribute>
                <name>model</name>
                <required>false</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Global variable for the value named 'model'</description>
            </attribute>
        </tag>
    
    
        <tag>
            <name>bofTag</name>
            <display-name>model:bofTag</display-name>
            <tag-class>se.abalon.tag.bof.SuperTag</tag-class>
            <body-content>JSP</body-content>
            <description>A tag capable of rendering most types of output fields</description>
            <example>
                <![CDATA[<model:bofTag mode="EDIT" type="NON-EXCLUSIVE" model="${request.model}" field="PROPERTIES"></model:bofTag>]]>
            </example>
            <attribute>
                <name>model</name>
                <required>false</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Add desc.</description>
            </attribute>
            <attribute>
                <name>field</name>
                <required>false</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Add desc.</description>
            </attribute>
            <attribute>
                <name>value</name>
                <required>false</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Add desc.</description>
            </attribute>
            <attribute>
                <name>mode</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Add desc.</description>
            </attribute>
            <attribute>
                <name>type</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Add desc.</description>
            </attribute>
        </tag>
    
        <tag>
            <name>listInfo</name>
            <display-name>model:listInfo</display-name>
            <tag-class>se.abalon.tag.model.ListInfoTag</tag-class>
            <body-content>JSP</body-content>
            <description>Tag for creating information of top x of all models. Like showing 4 of 7 [view all] If the showAll atribute is set a "ShowAll" button will apper if less then total is listed.</description>
            <example>
                <![CDATA[<model:listInfo collection="${request.modelCollection}" total="${request.nbrHits}" offset="${flow.offset}" />]]>
            </example>
            <attribute>
                <name>collection</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Add desc.</description>
            </attribute>
            <attribute>
                <name>total</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Valid data for the "total" attribute is an Object of the following type Integer, String, Long or null.</description>
            </attribute>
            <attribute>
                <name>showAll</name>
                <required>false</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Add desc.</description>
            </attribute>
            <attribute>
                <name>offset</name>
                <required>false</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Add desc.</description>
            </attribute>
        </tag>
    
        <tag>
            <name>collectionSelect</name>
            <display-name>model:collectionSelect</display-name>
            <tag-class>se.abalon.tag.model.CollectionSelectTag</tag-class>
            <body-content>empty</body-content>
            <description>Generate HTML select-tag based on a Model Collection (for example: based on an OQL query in the .xml file)</description>
            <example>
                <![CDATA[<model:collectionSelect modelCollection="${flow.callerCollection}" displayField="NAME" idField="ID" selectedValue="${request.responsibleId}" name="${flow.theCall}:SALESP:PLAIN"/>]]>
            </example>
            <attribute>
                <name>name</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Add desc.</description>
            </attribute>
            <attribute>
                <name>idField</name>
                <required>false</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Add desc.</description>
            </attribute>
            <attribute>
                <name>displayField</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Add desc.</description>
            </attribute>
            <attribute>
                <name>modelCollection</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
                <description>The model which to base the select-tag on.</description>
            </attribute>
            <attribute>
                <name>selectedValue</name>
                <required>false</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Add desc.</description>
            </attribute>
            <attribute>
                <name>emptyChoice</name>
                <required>false</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Add desc.</description>
            </attribute>
            <attribute>
                <name>cssClass</name>
                <required>false</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Add desc.</description>
            </attribute>
        </tag>
    
        <tag>
            <name>inputLookup</name>
            <display-name>model:inputLookup</display-name>
            <tag-class>se.abalon.tag.bof.InputLookupWithFlow</tag-class>
            <body-content>JSP</body-content>
            <description>Tag for representing a lookup field</description>
            <example>This tag is widely used in edit and insert pages. Please check the template solution for lots of examples.</example>
            <attribute>
                <name>usecase</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Add desc.</description>
            </attribute>
            <attribute>
                <name>label</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Add desc.</description>
            </attribute>
            <attribute>
                <name>model</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
                <description>The model to use when generating output</description>
            </attribute>
            <attribute>
                <name>field</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Add desc.</description>
            </attribute>
            <attribute>
                <name>displayField</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Add desc.</description>
            </attribute>
        </tag>
    
        <tag>
            <name>iterate</name>
            <display-name>model:iterate</display-name>
            <tag-class>se.abalon.tag.model.IterateTag</tag-class>
            <body-content>JSP</body-content>
            <description>Iterates over a Collection of Models and stores the current model temporarily.</description>
            <example>
                <![CDATA[<model:iterate collection="${session.actionStatusCollection}" object="${request.status}"> ...some code... </model:iterate>]]>
            </example>
            <attribute>
                <name>object</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
                <description>The variable to store each object/iteration when executed.</description>
            </attribute>
            <attribute>
                <name>collection</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Which collection to iterate over.</description>
            </attribute>
        </tag>
    
        <tag>
            <name>relationIterator</name>
            <display-name>model:relationIterator</display-name>
            <tag-class>se.abalon.tag.model.RelationIteratorTag</tag-class>
            <body-content>JSP</body-content>
            <description>Follows a 01-, 11- and 0M-relation on a Model and store the related model into context.</description>
            <example>
                <![CDATA[<model:relationIterator model="${request.project}" relation="currency" related="${request.currency}"> .. some code.. </model:relationIterator>]]>
            </example>
            <attribute>
                <name>model</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Which model to iterate over</description>
            </attribute>
            <attribute>
                <name>related</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Which releation to "follow".</description>
            </attribute>
            <attribute>
                <name>relation</name>
                <required>true</required>
                <rtexprvalue>false</rtexprvalue>
                <description>Which relation</description>
            </attribute>
        </tag>
    
    </taglib>
    

    thank you for helping me with these .. I cant say I´m a jsp guru .. that would be a lie 😉

    #251304

    Riyad Kalla
    Member

    Ok so right off the bat I get the 2 errors, but this is the important one: “SchemaLocation: schemaLocation value = ‘http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd&#8217; must have even number of URI’s. taglib.tld”, so I opened c.tld from JSTL 1.1 and copied it’s header since it’s the full taglib header you can use:

    
    <taglib xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
        version="2.0">
    

    Holy crap now the entire TLD is lit up with errors. So I think you need to get your TLD validating correctly first. As a cheat sheet, create a web project, name it something like “DummyProject” and add JSTL 1.1 caps to it, that will dump a punch of .tld files in the WEB-INF folder for you, you can use the c.tld file as an example.

    Also I don’t know why you aren’t seeing these validation errors, make sure XML validation is on AND you are opening your TLD files using the “MyEclipse XML Editor”. Also it looks like *most* of your problem is an ordering issue. When you see an error like “invalid content found starting with blah blah…” that means “wrong order”.

    #251395

    Jan-Eric Myhrgren
    Participant

    Thanks for the quick response !

    For some reason I must have unchecked the xml validation -doh-. But now I have rewritten one of my tld´s and it is valid, but I still dont get the text inside the <description> (of the attribute) to appear in the autocomplete, I even restarted eclipse…

    I tried the above mentioned approach and created a dummy project etc..
    And then i created a simple jsp and imported the jstl and I got the description for the tag in the autocomplete but not for the attributes..? it only says “Attribute name: somName” and “Data type: CDATA” thats it …. :/ (i get the same result with my custom tld´s)

    Is there some setting in myeclipse that I have missed to get this feature to work ? Is it supported in myeclipse?

    Thanks in advance 😉

    #251403

    Riyad Kalla
    Member

    Abalon,
    Glad you got your TLD fixed up… there is no setting to switch on or off to speak of, I *know* this issue because I ran into it a while ago and as it turned out, I think the parser doesn’t read the description value but some other value that I remember being a little surprised by.

    We are doing a total refresh of our editors for MyEclipse 5.0 and hope to have a M1 release out here in the next 2 weeks, would you be able to pop open a project in M1 and see if it’s working all the sudden, and if it’s not I’ll file it as a bug.

    #251467

    Jan-Eric Myhrgren
    Participant

    Hi agian.

    I have now edited all my tld´s and there are all valid, I still dont get the description in the context help after many tries.. 🙁 it is not a super biggie, but as you said it’s probably just a parser-“bugg”.
    It would be nice though if myeclipse could handle all the nifty things that is available in the jsp 2.0 spec 😉

    Of course I will try with the M1 release and keep you updated !

    Thanks for the quick response and helping me to clear out my tld´s !

    regards
    Niclas /abalon

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: Autocompletion for jsp´s (jsp 2.0)

You must be logged in to post in the forum log in