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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:08:36+00:00 2026-06-08T00:08:36+00:00

Im just testing out JSF 2 with Primefaces and are setting up a basic

  • 0

Im just testing out JSF 2 with Primefaces and are setting up a basic test-form.
The goal is to submit the form and then send the user to a page listing all the entries.

But all that happens if i click “Add” button is that my webapp tries to navigate to page: “//pages/index.xhtml”, and there nothing is found…

Any ideas?? I have followed tutorials pretty much, but cant see where i got it wrong..
I have mapped the commandbutton to the ManagedBean-method “addUser”. The addUser method returns “success”, and i have set up “success” to go to success.xhtml..

I have spent 3 hours debugging this now and i’m about to go crazy, so any help would be greatly appriciated…

index.xhtml:

<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:p="http://primefaces.org/ui">
    <h:head><title>Welcome to OTV_JSF_Spring_Hibernate_Project</title></h:head>
    <h:body>
        <h:form>
          <table>
              <tr>...</tr>
              <tr>
                 <td><p:commandButton id="addUser" value="Add" action="#{userMB.addUser}" ajax="false"/></td>
                 <td><p:commandButton id="reset" value="Reset" action="#{userMB.reset}" ajax="false"/></td>
              </tr>
          </table>
      </h:form>
    </h:body>
</html>

userMB:

@ManagedBean(name = "userMB")
@RequestScoped
public class UserManagedBean implements Serializable {
    private static final String SUCCESS = "success";
    private static final String ERROR = "error";
    /* .... */

    public String addUser() {
        return SUCCESS;
    }

faces-config.xml:

<?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">

<!-- JSF and Spring are integrated -->
<application>
    <el-resolver>
        org.springframework.web.jsf.el.SpringBeanFacesELResolver
    </el-resolver>
</application>

<!-- configuration of navigation rules -->
<navigation-rule>
    <from-view-id>/pages/index.xhtml</from-view-id>
    <navigation-case>
        <from-outcome>success</from-outcome>
        <to-view-id>/pages/success.xhtml</to-view-id>
    </navigation-case>
    <navigation-case>
        <from-outcome>error</from-outcome>
        <to-view-id>/pages/error.xhtml</to-view-id>
    </navigation-case>
</navigation-rule>

</faces-config>

Web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns="http://java.sun.com/xml/ns/javaee"
     xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
     id="WebApp_ID"
     version="2.5">

<display-name>OTV_JSF_PrimeFaces_Spring_Hibernate</display-name>

<!-- Spring Context Configuration' s Path definition -->
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        /WEB-INF/applicationContext.xml
    </param-value>
</context-param>

<!-- The Bootstrap listener to start up and shut down Spring's root WebApplicationContext. It is registered to Servlet Container -->
<listener>
    <listener-class>
        org.springframework.web.context.ContextLoaderListener
    </listener-class>
</listener>
<listener>
    <listener-class>
        org.springframework.web.context.request.RequestContextListener
    </listener-class>
</listener>

<!-- Project Stage Level -->
<context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
</context-param>

<!-- Welcome Page -->
<welcome-file-list>
    <welcome-file>/pages/index.xhtml</welcome-file>
</welcome-file-list>

<!-- JSF Servlet is defined to container -->
<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<!-- Mapping with servlet and url for the http requests. -->
<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>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
</servlet-mapping>
</web-app>

Generated HTML

  • 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-08T00:08:37+00:00Added an answer on June 8, 2026 at 12:08 am

    I think you have to write in this way:

    <?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">
    
        <!-- JSF and Spring are integrated -->
        <application>
            <el-resolver>
                org.springframework.web.jsf.el.SpringBeanFacesELResolver
            </el-resolver>
        </application>
    
        <!-- configuration of navigation rules -->
        <navigation-rule>
            <from-view-id>pages/index.xhtml</from-view-id>
            <navigation-case>
                <from-outcome>success</from-outcome>
                <to-view-id>pages/success.xhtml</to-view-id>
            </navigation-case>
            <navigation-case>
                <from-outcome>error</from-outcome>
                <to-view-id>pages/error.xhtml</to-view-id>
            </navigation-case>
        </navigation-rule>
    
    </faces-config>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just testing out some basic networking code written in Visual C++. I have
I'm just testing out replacing a whole page with another page using JavaScript and
i'm just testing out the csv component in python, and i am having some
I have just started out with testing some php mvc framework In it, it
I am just getting started with JS Unit Testing and am trying out qUnit.
I'm using Test::Unit with shoulda to test a controller. Since I'm just testing the
I'm new in QT, and I'm just testing out the MOC. For a given
I just installed Aptana Studio 3 and I'm testing out PHP. I tested to
I'm just testing out saving to a file from a servlet, and I want
Ok so I am testing out EF once again for performance and I just

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.