jsf - Properties of new tags using composite component are not displayed by Eclipse auto complete shortcurt -


i have developed composite components using jsf 2.0 in eclipse. i've been putting xhtml tag files inside resources folder.

when hit ctrl + space in keyboard, property of tag not displayed.

i found tips told install "jboss tools" didn't work.

<?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:cc="http://xmlns.jcp.org/jsf/composite"       xmlns:h="http://xmlns.jcp.org/jsf/html"       xmlns:f="http://xmlns.jcp.org/jsf/core"       xmlns:p="http://primefaces.org/ui">      <cc:interface>         <cc:attribute name="value"/>         <cc:attribute name="label"/>         <cc:attribute name="masculino" default="true"/>     </cc:interface>      <cc:implementation>         <p:selectonemenu value="#{cc.attrs.value}" label="#{cc.attrs.label}">             <f:selectitem itemvalue="#{null}"                           itemlabel="#{cc.attrs.masculino ? lbl['label.todos'] : lbl['label.todas']}" />             <f:selectitem itemvalue="true" itemlabel="#{lbl['label.sim']}" />             <f:selectitem itemvalue="false" itemlabel="#{lbl['label.nao']}" />         </p:selectonemenu>                                       </cc:implementation>  </html> 

above 1 example of 1 tag created.

thanks

jsf 2.x facelets support integrated in "eclipse ide java ee developers" (note ee, not "eclipse ide java developers"), since eclipse helios (version 3.6, released june 2010). need ensure javaserver faces facet enabled in project facets section of project's properties , set minimum of version 2.0.

enter image description here

this configureable during in new dynamic web project wizard, when importing non-eclipse projects or creating non-dynamic web project projects (e.g. maven archetypes), need manually check/add it.

once integrated, jsf tag autocomplete default available on java.sun.com xml namespace.

enter image description here

the new xmlns.jcp.org namespace isn't recognized default (currently tested eclipse version luna sr2).

enter image description here

the new xmlns.jcp.org namespace work if you've added physical jsf 2.2 implementation build path in flavor of full fledged java ee container having jsf 2.2 in modules, integrated via decent server plugin , set targeted runtimes in project's properties, or concrete jsf 2.2 implementation jar file in /web-inf/lib in case of tomcat , clones (or adding maven dependency).

enter image description here

it still doesn't recognize composites in new xml namespace. when changing java.sun.com, code completion of composite component tags back, code completion of attributes on tags not available.

enter image description here

then installed jboss tools 4.2.3 eclipse luna , enabled jboss tools knowledge base in project's properties.

enter image description here

after closing , reopening facelet (so jboss builtin html editor gets opened; can set/configure editor used rightclick, open with), , switching source tab (please don't use visual editor, disaster), got code completion of attribtues on composite components.

enter image description here

only xmlns.jcp.org still didn't work. it's eclipse specific issue , fixed in mars or newer. can hide composite namespace behind custom xml namespace below:

/web-inf/my.taglib.xml

<?xml version="1.0" encoding="utf-8"?> <facelet-taglib     xmlns="http://xmlns.jcp.org/xml/ns/javaee"     xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facelettaglibrary_2_2.xsd"     version="2.2" >     <namespace>http://example.com/my</namespace>     <composite-library-name>components</composite-library-name> </facelet-taglib> 

/web-inf/web.xml

<context-param>     <param-name>javax.faces.facelets_libraries</param-name>     <param-value>/web-inf/my.taglib.xml</param-value> </context-param> 

enter image description here

so, summarized:

  • enable jsf project facet in project's properties code completion on composite tags.
  • install jboss tools code completion on attribtues in composite tags.
  • enable jboss tools knowledge base in project's properties.
  • have physical jsf 2.2 impl jar in buildpath xmlns.jcp.org support on standard tags.
  • use java.sun.com xml namespace domain or custom taglib (or newer eclipse version) on composite tags.

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -