Running JSF 2.0 examples on tomcat server using eclipse wtp and m2eclipse

Environment configuration

  • You can obtain jsf 2.0 project here For now available betta 2 release. Work uder specification is finished already.
  • Then you should download and install eclipse+m2eclips+wtp plugin with maven integration for wtp enabled.
  • Download and unzip tomcat 6+
  • Copy jsf-impl.jar and jsf-api.jar into tomcat/lib folder

Running Jsf 2.0 samples
For now only project in jsf 2.0 samples going as maven project with pom files, it's ajax-queue example and ajax-request.

  • So import as maven project this samples in eclipse worksace
  • Right click on project and select run on server, as server you should provide tomcat 6
  • Open pages in browser :-)

Comments

cannot find symbol symbol: class ManagedBean

I have jsf-impl and jsf-api jars in my pom.xml file like this

<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.2</version>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.0.2</version>
<scope>runtime</scope>
</dependency>

package org.sakotek.eshop.web.controller;

import javax.faces.bean.ManagedBean;

@ManagedBean
public class TestCtlr {

public String getTest(){
return "this is some testController";
}
}

package org.sakotek.eshop.web.model;

import java.io.Serializable;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean
@SessionScoped
public class TestMdl implements Serializable {

private static final long serialVersionUID = 1L;

private String testVar = "This is a test variable";

public void setTestVar(String testVar) {
this.testVar = testVar;
}

public String getTestVar() {
return testVar;
}

}

but I am still getting the above error. Bellow is the complete error please help.

/Users/bsakwe/dev/atlworkspace/eshop/eshop-web/src/main/java/org/sakotek/eshop/web/model/TestMdl.java:[8,1] cannot find symbol
symbol: class ManagedBean
@ManagedBean

/Users/bsakwe/dev/atlworkspace/eshop/eshop-web/src/main/java/org/sakotek/eshop/web/model/TestMdl.java:[9,1] cannot find symbol
symbol: class SessionScoped
@SessionScoped

When I changed the scope to

When I changed the scope to compile the error disappears but the ManagedBeans are not resolved. I am using embedded tomcat 6.0.16 and maven 2.0. I also followed your directions and included the jars in the lib folder of my local tomcat but for some reason my managedBean el values are not resolved. It seems as though they are not scanned. Thanks in advance for your for your help.

RE cannot find symbol symbol: class ManagedBean

Sory for not answering, New Year and etc :-). Yes, changing scope can help you or you can even remove scope at all. Better late then never :-)