Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8159325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:52:13+00:00 2026-06-06T17:52:13+00:00

I am having trouble getting the JSF annotations to work. I have spent some

  • 0

I am having trouble getting the JSF annotations to work. I have spent some time trying to figure this out. I am useing Maven + Tomcat7 + JSF2.16 + JDK1.7 + Spring 3 + Hibernate 4.
Please forgive me in advance if it is something simple as I am a newbie.

Here is my pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.uk.todolist</groupId>
<artifactId>UkToDoList</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>UkToDoList</name>
<url>http://maven.apache.org</url>

<repositories>
    <repository>
        <id>prime-repo</id>
        <name>PrimeFaces Maven Repository</name>
        <url>http://repository.primefaces.org</url>
        <layout>default</layout>
    </repository>
</repositories>

<properties>
    <spring.version>3.1.1.RELEASE</spring.version>
    <spring.security.version>3.0.5.RELEASE</spring.security.version>
</properties>


<dependencies>

    <!-- Spring 3 dependencies -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${spring.version}</version>
    </dependency>   

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>${spring.version}</version>            
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <!-- Spring Security -->
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>${spring.security.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>${spring.security.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>${spring.security.version}</version>
    </dependency>

    <!-- JSF library -->
    <dependency>
      <groupId>com.sun.faces</groupId>
      <artifactId>jsf-api</artifactId>
      <version>2.1.6</version>
    </dependency>

    <dependency>
      <groupId>com.sun.faces</groupId>
      <artifactId>jsf-impl</artifactId>
      <version>2.1.6</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

    <!-- Primefaces library -->
    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>3.1.1</version>
    </dependency>

    <!-- Hibernate library -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.1.0.Final</version>
    </dependency>

    <!-- MySQL Java Connector library -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.20</version>
    </dependency>

    <dependency>
        <groupId>c3p0</groupId>
        <artifactId>c3p0</artifactId>
        <version>0.9.1.2</version>
    </dependency>            

    <!-- Log4j library -->
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>

</dependencies>

<build>     
    <finalName>UkToDoList</finalName>
</build> 

My Faces config file is declared as JSF 2 as follows

    <?xml version="1.0" encoding="UTF-8"?>
    <faces-config
     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-facesconfig_2_0.xsd"
version="2.0">

My Managed bean is annotated as follows

    @ManagedBean
    @ViewScoped
    public class TaskManagedBean implements Serializable {

private static final long serialVersionUID = 1L;
private static final String SUCCESS = "success";
private static final String ERROR   = "error";

//NOTE: Task Service is injected
@ManagedProperty(value="#{TaskService}")
TaskService taskService;

If I declare the managed beans in faces-config like so

     <managed-bean>
       <managed-bean-name>taskManagedBean</managed-bean-name>
       <managed-bean-          class>com.uk.todolist.managed.bean.TaskManagedBean</managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>     
    </managed-bean>

This works but I do not understand why the annotations do not.

Any Help or direction and I would be very grateful!
Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:52:16+00:00Added an answer on June 6, 2026 at 5:52 pm

    I don’t think you can use the JSF annotation for beans. But may be I’m wrong

    I use the same technologies as you and I don’t use JSF annotation. I do like this instead :

    @Component
    @Scope(value = "session")
    public class TaskManagedBean implements Serializable {
    
    private static final long serialVersionUID = 1L;
    private static final String SUCCESS = "success";
    private static final String ERROR   = "error";
    
    //NOTE: Task Service is injected
    @Autowired
    TaskService taskService;
    

    And don’t forget to insert like Petter said.

    <context:component-scan base-package="your.base.package" />
    

    You should know that there is no view scope in Spring and you should implement yourself. But don’t be afraid there is a lot of examples : https://www.google.fr/search?sugexp=chrome,mod=7&sourceid=chrome&ie=UTF-8&q=spring+custom+viewscope

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having trouble getting this to work. What's strange is that I have 10 bookmarks
I am having trouble getting my application to work correctly. I am trying to
I have the jsf code and css code below. I'm having trouble getting the
I having trouble getting append() to work in safari for some reason, but it
Having trouble getting the following code to work: $('#changeMode').button().click(function(){ $('#playfield').toggle(function() { $(this).switchClass(gridView,plainView); }, function()
Im having trouble getting some html 5 code to work on the android. It
Im having trouble getting this to work, here´s a quick overview of the idea.
I am having trouble getting these two elements to work at the same time
I am having trouble getting this to work so any help would be appreciated!
Having trouble getting this to work: /// <summary> /// Retrieve search suggestions from previous

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.