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

  • Home
  • SEARCH
  • 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 7886299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:17:03+00:00 2026-06-03T05:17:03+00:00

Hello I am building a website using JSF 2.0. I am trying to set

  • 0

Hello I am building a website using JSF 2.0.

I am trying to set up a commandButton so that after i press it it does some stuff with a method then navigates to a page dependent on what is returned from the method.

Until now i have only been using the JSF 2.0 action navigation but from what I have read it is not possible to have two actions so you must use a faces-config.xml file.

I have tried creating one and making a navigation rule but i cannot get it working. Think it is maybe a problem declaring it in my web.xml. I tried to keep in the original param values but the code would not compile so it is commented out:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 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_3_0.xsd">
<context-param>
    <!--
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
    -->

    <param-name>javax.faces.CONFIG_FILES</param-name> 
  <param-value>/WEB-INF/faces-config.xml</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>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
    <session-timeout>
        30
    </session-timeout>
</session-config>
<welcome-file-list>
    <welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
</web-app>


<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>

My faces-config file is 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">

   <navigation-rule> 
<from-view-id>/tabletsHome.xhtml</from-view-id> 
<navigation-case> 
  <from-outcome>product1</from-outcome> 
  <to-view-id>/inputForm.xhtml</to-view-id> 
</navigation-case> 
<navigation-case> 
  <from-outcome>product2</from-outcome> 
  <to-view-id>/inputForm.xhtml</to-view-id> 
</navigation-case> 

Also after the navigation takes you to the next page is there a way to pass information to this page depending on what the person has clicked on. For example a product number?

Thank you in advance for any help you can offer.

  • 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-03T05:17:04+00:00Added an answer on June 3, 2026 at 5:17 am

    I’m not sure how web.xml/faces-config.xml are related to this. As to your context param problem, just create another <context-param>. But this won’t solve your problem. As to your navigation problem, you can just have a single action method which returns a different outcome.

    public String submit() {
        if (...) {
            return "view1";
        }
        else {
            return "view2";
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I'm trying to take backup from mysql command line client. I'm using mysqldump
I am building my portfolio website simply using HTML , Flash , and the
Hello I'm building a Spring MVC web application that runs on Tomcat 6.0.20 and
Intro Hello! I am in the process of building a lyrics website where I
I'm building a website that sends and email to a user when he registers.
I'm building an ASP.NET MVC3 website. I have some javascript in my .cshtml file:
Hello I'm trying to write some values to my SQL through the C# WinForm
Hullo, I'm trying to make a website in ruby on rails and I'm building
Hello I am building a simple aggregator script and I am trying to have
Hello all: I'm building an app using C#/MVC3/Razor which has a database configured in

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.