4 Replies Latest reply on Sep 17, 2008 9:17 PM by Josef Grabner

    Annotation "@Name" not recognized

    Josef Grabner Newbie

      Hello!


      I set up a working facelets project. The next step was to integrate
      Seam. I removed the MangedBean Tag from faces-config and added
      the @Name annotation to my bean and expected to have the same result but
      nothing happens (even no error message).


      If you have any suggestions to solve my problem i was very thankful :)



      Here are my sources:


      web.xml:


      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.5" 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-app_2_5.xsd"> 
          <display-name>Archetype Created Web Application</display-name>
          
          <context-param>
              <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
              <param-value>.xhtml</param-value>
          </context-param>
          
          <context-param>
              <param-name>facelets.DEVELOPMENT</param-name>
              <param-value>true</param-value>
          </context-param>
          
          <servlet>
              <servlet-name>Faces Servlet</servlet-name>
              <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
              <load-on-startup>1</load-on-startup>
          </servlet>
          
          <servlet-mapping>
              <servlet-name>Faces Servlet</servlet-name>
              <url-pattern>*.jsf</url-pattern>
          </servlet-mapping>
          
          <listener>
              <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
          </listener>
          
      </web-app>



      Bean:


      import org.jboss.seam.annotations.Name;
      
      /**
       *
       * @author josef
       */
      @Name("DataBean")
      public class DataBackingBean {
          public int getNumberOfEmployees() {
              return 23;
          }
          
      
      }




      XHTML:


      <!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:ui="http://java.sun.com/jsf/facelets"
            xmlns:h="http://java.sun.com/jsf/html">
          <body>
              The number of Employees is #{DataBean.numberOfEmployees}.<br/>
          </body>
      </html>



      Components.xml (EMPTY)


      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://jboss.com/products/seam/components"
                  xmlns:core="http://jboss.com/products/seam/core"
                  xmlns:persistence="http://jboss.com/products/seam/persistence"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation=
                      "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd 
                       http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd
                       http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
      
      </components>



      I use Maven to build the project and these are the dependencies i added for seam and facelets:


       <dependency>
                  <groupId>com.sun.facelets</groupId>
                  <artifactId>jsf-facelets</artifactId>
                  <version>1.1.14</version>
          </dependency>
          <dependency>
                  <groupId>org.jboss.seam</groupId>
                  <artifactId>jboss-seam</artifactId>
                  <version>2.0.0.GA</version>
          </dependency>
          <dependency>
                  <groupId>org.jboss.seam</groupId>
                  <artifactId>jboss-seam-ui</artifactId>
                  <version>2.0.0.GA</version>
          </dependency>
          <dependency>
                  <groupId>org.jboss.seam</groupId>
                  <artifactId>jboss-el</artifactId>
                  <version>2.0.0.GA</version>
              </dependency>
              <dependency>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-validator</artifactId>
                  <version>3.0.0.ga</version>
              </dependency>