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 9027639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:47:36+00:00 2026-06-16T06:47:36+00:00

I have a problem related to JSF 2 . I’m using the 2.1.4 version

  • 0

I have a problem related to JSF 2. I’m using the 2.1.4 version with a Tomcat 6 server. I’m migrating an application that was originally written for jsf 1.2. According that, every JSF managed bean for the application is declared in the faces-managed-beans.xml file. The problem comes when I try to set a property using new JSF 2 @ManagedProperty annotation. For example this code works for me.

<managed-bean>
    <managed-bean-name>navegableSessionParamsManager</managed-bean-name>
    <managed-bean-class>com.tesicnor.system.view.beans.navegable.NavegableSessionParamsManager</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>

    <managed-property>
        <property-name>_LoggedBean</property-name>
        <value>#{loggedBean}</value>
    </managed-property>
    <managed-property>
        <property-name>_LocaleBean</property-name>
        <value>#{localeBean}</value>
    </managed-property>

</managed-bean>

The session scoped navegableSessionParamsManager bean is receiving both loggedBean and localeBean values, which also are session scoped beans. However, if I use annotations I declare the three @ManagedBean and @SessionScoped, and I use @ManagedProperty(“#{loggedBean}”) and @ManagedProperty(“#{localeBean}”), but properties are not being set.

LoggedBean class.

@ManagedBean
@SessionScoped
public class LoggedBean extends BaseBean implements Observer {

 /**
 * 
 */
private static final long serialVersionUID = 1L; 
...

NavegableSessionParamsManager class

@SuppressWarnings("serial")
@ManagedBean
@SessionScoped
public class NavegableSessionParamsManager extends SystemNavegable {

@ManagedProperty("#{loggedBean}")
private LoggedBean _LoggedBean;

public void set_LoggedBean(LoggedBean _LoggedBean) {
    this._LoggedBean = _LoggedBean;
}
...

That’s my web.xml file

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" 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>System_V4</display-name>
<context-param>
    <param-name>javax.faces.CONFIG_FILES</param-name>
    <param-value>/WEB-INF/faces-config.xml, /WEB-INF/faces-managed-beans.xml, /WEB-INF/faces-navigation.xml</param-value>
</context-param>
<context-param>
    <description>Do not render comments in facelets (xhtml) pages. Default is false.</description>
    <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
    <param-value>true</param-value>
</context-param>
<context-param>
    <description>
        Define the value returned by Application.getProjectStage(). Allowed values: Production, Development,
        UnitTest, SystemTest, Extension. Default value is Production.
    </description>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
</context-param>
<context-param>
    <param-name>primefaces.THEME</param-name>
    <param-value>pepper-grinder</param-value>
</context-param>

<!-- filter enforcing charset UTF-8 - must be first filter in the chain! -->
<filter>
    <filter-name>characterEncodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
        <param-name>encoding</param-name>
        <param-value>utf-8</param-value>
    </init-param>
    <init-param>
        <param-name>forceEncoding</param-name>
        <param-value>true</param-value>
    </init-param>
</filter>
<filter-mapping>
    <filter-name>characterEncodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>


<!-- Advanced Security Filter -->
<!-- FILTRO PROPIO. -->
<filter>
    <filter-name>SystemFilter</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
    <filter-name>SystemFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>

<filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

<filter>
    <filter-name>SystemUrlFilter</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>

<filter-mapping>
    <filter-name>SystemUrlFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

<!-- Filter to set character encoding on each request "Set Character Encoding" 
    for "X-UA-Compatible" de microsoft -->
<filter>
    <filter-name>SetHttpHeadersFilter</filter-name>
    <filter-class>com.tesicnor.system.view.filters.SetHttpHeadersFilter</filter-class>
    <init-param>
        <param-name>X-UA-Compatible</param-name>
        <param-value>IE=EmulateIE7</param-value>
    </init-param>
</filter>
<!-- Primefaces -->
<filter>
    <filter-name>PrimeFaces FileUpload Filter</filter-name>
    <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>SetHttpHeadersFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>PrimeFaces FileUpload Filter</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<listener>
    <listener-class>org.quartz.ee.servlet.QuartzInitializerListener</listener-class>
</listener>
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
    <listener-class>com.tesicnor.system.view.session.WebSessionListener</listener-class>
</listener>
<listener>
    <listener-class>com.tesicnor.system.view.session.WebRequestListener</listener-class>
</listener>

<!-- FIN JavaServer Faces Faces Servlet -->
<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<!-- SERVLET DE CXF (Web Services) -->
<servlet>
    <servlet-name>CXFServlet</servlet-name>
    <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
</servlet>
<!-- FIN Faces Servlet Faces Servlet Mapping -->
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/ws/*</url-pattern>
</servlet-mapping>
<session-config>
    <session-timeout>60</session-timeout>
</session-config>
<welcome-file-list>
    <welcome-file>index.html</welcome-file>
</welcome-file-list>

<error-page>
    <error-code>404</error-code>
    <location>/404.xhtml</location>
</error-page>

I don’t know what kind of advantages using annotations in JSF 2 has, but everybody is doing that. Also, can I be in trouble if I use annotations and also xml bean mappings for the same bean?

  • 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-16T06:47:37+00:00Added an answer on June 16, 2026 at 6:47 am

    Finally after a while I have solved it adding *.faces and *.xhmtml servlet-mappings in my web.xml, which where not required before.

    With that:

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.faces</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
    

    Now annotations are working.

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

Sidebar

Related Questions

I m creating an app using JSF. The problem I have is that every
I have a problem related to foreign keys. I am using SQL Server 2008.
I'm using EJB3 and I have a problem related to refreshing my EntityManager .
I have a JSF 1.2 application (Sun RI, Facelets, Richfaces) that was used only
I am developing an Mac Desktop application. I have the problem related to Spaces
I have a problem related to the app that I developed which runs on
I have problem related with question I've set contentsScale and after that text looking
I have a little problem related to uploading an image to server taken with
Related to my JSF application, I noticed there's a problem with the Mojarra JSF
I'm building a node.js application with Mongoose and have a problem related to sorting

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.