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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:58:45+00:00 2026-05-23T02:58:45+00:00

I am trying to make a very simple application. With a starting menu as

  • 0

I am trying to make a very simple application. With a starting menu as a welcome page, however I am having problems with faces components not being displayed.

The relevant snippet of my web.xml

<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<session-config>
    <session-timeout>
        30
    </session-timeout>
</session-config>
<welcome-file-list>
    <welcome-file>menu.xhtml</welcome-file>
</welcome-file-list>
<filter>
    <filter-name>WelcomeFileFilter</filter-name>
    <filter-class>giu.WelcomeFileFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>WelcomeFileFilter</filter-name>
    <url-pattern>/menu.xhtml</url-pattern>
</filter-mapping>

My menu.xhtml file

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
            xmlns:h="http://java.sun.com/jsf/html"
            xmlns:ui="http://java.sun.com/jsf/facelets"
            xmlns:p="http://primefaces.prime.com.tr/ui"
            xmlns:f="http://java.sun.com/jsf/core">
<h:form id="menuForm">
    <h1><h:outputText id="menuTitle" value="Menu Principal"/></h1><br/><br/>
    <h3><h:outputText id="patientsTitle" value="Pacientes"/></h3><br/>
    <h:panelGrid id="patientsGrid" columns="2">
        <h:outputText value="Consultar, Crear, Editar o Eliminar Paciente"/>
        <p:commandButton id="goToPatientsButton" value="Ir"/>
    </h:panelGrid><br/><br/>
    <h3><h:outputText id="doctorsTitle" value="Medicos"/></h3><br/>
    <h:panelGrid id="doctorsGrid" columns="2">
        <h:outputText value="Consultar, Crear, Editar o Eliminar Medicos"/>
        <p:commandButton id="goToDoctorsButton" value="Ir"/>
    </h:panelGrid><br/><br/>
    <h3><h:outputText id="medicalHistoryTitle" value="Historias Medicas"/></h3><br/>
    <h:panelGrid id="medicalHistoryGrid" columns="2">
        <h:outputText value="Consultar, Crear, Editar o Eliminar Historias Medicas"/>
        <p:commandButton id="goToMedicalHistoriesButton" value="Ir"/>
    </h:panelGrid>
    <p:dataTable emptyMessage="Vacio" paginator="true"/>
</h:form>

I dont know what am I doing wrong, plain html components such as texts and buttons display correctly, however primefaces components such as datatables and messages are not being displayed.

If it serves for anything, my question is closely related to: How to set ‘JSF2 welcome-file’ with faces servlet mapping?

Thanks for any help

  • 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-05-23T02:58:46+00:00Added an answer on May 23, 2026 at 2:58 am

    The <welcome-file> cannot be a “virtual” URL. Define it to be menu.xhtml and create a Filter which is mapped on /menu.xhtml and redirects to the proper URL.

    @WebFilter(urlPatterns={"/menu.xhtml"})
    public class WelcomeFileFilter implements Filter {
    
        @Override
        public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
            ((HttpServletResponse) response).sendRedirect("faces/menu.xhtml");
        }
    
        // ...
    }
    

    Or even better, you can also consider to just get rid of the /faces/* prefix mapping altogether in favour of an extension mapping. I recommend to use *.xhtml so that you never need to worry about the URLs and also not about the risk that the JSF source code get exposed when the enduser wishfully edits the URL to remove the JSF mapping.

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>menu.xhtml</welcome-file>
    </welcome-file-list>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to make a MySQL-based application support MS SQL, I ran into the following
I'm trying to make a context menu for a control that is linked to
I'm trying to do a very simple task: take a unicode-aware wstring and convert
Trying to make a make generic select control that I can dynamically add elements
Trying to make a generic PL/SQL procedure to export data in specific XML format,
Trying to make a web service call to an HTTPS endpoint in my Silverlight
I'm trying to make the case for click-once and smart client development but my
I'm trying to make a data bound column invisible after data binding, because it
I am trying to make a div, that when you click it turns into
I am trying to make a JTable that has column spans available. Specifically, I

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.