Hi,

i am trying to develop a simple JEE6 Application with JSF 2.0 as presentation layer.

The Model includes a simple inheritance association: The entity classes "Van" and "Motorbike" both extend the class "vehicle".

In order to cover this inheritance in the View, i use JSF Composite Components. I´d like to build an input form which contains the input text fields for all the attributes of the vehicle class which the derived classes have in common.

Problem #1:

My Composite File looks like this:

??<?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:h="http://java.sun.com/jsf/html"
    xmlns:cc="http://java.sun.com/jsf/composite">

  <!-- INTERFACE -->
  <cc:interface>
    <cc:attribute name="vehicle" required="true"/>
    <cc:attribute name="style" required="false"/>
  </cc:interface>

  <!-- IMPLEMENTATION -->

  <cc:implementation>

      <tr>
          <td>Manufacturer: </td>
       <td>
           <h:inputText value="#{cc.attrs.vehicle.manufacturer}"></h:inputText>
        </td>
      </tr>
  </cc:implementation>

</html>

??

The problem occurs in the line

<h:inputText value="#{cc.attrs.vehicle.manufacturer}"></h:inputText>

when I type the "attrs." element within the expression, a "no suggestions" popup appears. But in my opinion there should appear a popup offering the elements "vehicle" and "style" as they are noted in the interface area. I googled it extensively but found no real solution. But I guess this behaviour is just the appearance of a bigger problem which i dont understand.

 

Problem #2: Referencing the Composite File in an JSF Page

 

Next, I want to use the composite component in an JSF Page, i.e. for building the input form for the "van" objects.

so i register the namespace and reference the project folder in which the composite file is contained:

 

?<?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:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:rzcomp="http://java.sun.com/jsf/composite/rzcomp">

 

The line marked bold causes a error: "No library found for this namespace". rzcomp is the folder in the resources folder of my WAR-Module, which contains the composite file.

I googled that problem too and found something about editing the web.xml with an additional context parameter, but I did´nt really understand where the problem is.

 

I really hope for your help, i´m quite frustrated already :-(

P.S. I Use NetBeans 6.9.1