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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:32:58+00:00 2026-06-15T13:32:58+00:00

In JSF 2.0, how can I hide .xhtml extension from URL? Can this be

  • 0

In JSF 2.0, how can I hide .xhtml extension from URL? Can this be configured in web.xml?

I just want to change current URL “http://localhost:8080/sms/faces/admin/account/process_monthly_fee.xhtml" to ".../process_monthly_fee.jsf".

Adding following context parameter in to web.xml does not solve my problem but my application displays nothing:

<context-param>
   <param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name>
   <param-value>*.jspx</param-value>
</context-param>

OR

<context-param>
  <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
  <param-value>.jspx</param-value>
</context-param>

my web.xml file is like this :

<?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_3_0.xsd" id="WebApp_ID" version="3.0">

  <display-name>School Management System</display-name>
  <welcome-file-list>
    <welcome-file>faces/index.xhtml</welcome-file>
  </welcome-file-list>
  <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>

 <servlet>
    <servlet-name>upload</servlet-name>
    <servlet-class>com.sms.model.student.Upload</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>upload</servlet-name>
    <url-pattern>/Upload</url-pattern>
  </servlet-mapping> 
<servlet>
    <servlet-name>marks</servlet-name>
    <servlet-class>com.sms.student.service.Mark</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>marks</servlet-name>
    <url-pattern>/marks</url-pattern>
  </servlet-mapping>
  <error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/error/error.xhtml</location>
  </error-page>
  <session-config>
    <session-timeout>30</session-timeout>
  </session-config>
<filter>
    <filter-name>Extensions Filter</filter-name>
    <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>Extensions Filter</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
</filter-mapping>  
<context-param>
<param-name>org.richfaces.skin</param-name>
<param-value>classic</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.enableControlSkinning</param-name>
<param-value>true</param-value>
</context-param>
</web-app>
  • 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-15T13:32:58+00:00Added an answer on June 15, 2026 at 1:32 pm

    If you want to just change the extension, follow the advice in the link provided by @Captain Giraffe.

    To completely hide the extensions, you can use either PrettyFaces or OmniFaces.

    The OmniFaces showcase features an example.

    EDIT: I suppose the link provided by @Captain Giraffe solved a different issue – how to have files with a different extension then .xhtml to get picked up by JSF.

    If you want to change the extension at the end of your URL, you can add this to your web.xml:

    <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>*.foo</url-pattern>
    </servlet-mapping>
    

    From now on, your pages will be accessible as /YourApplicationRoot/pagename.foo

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

Sidebar

Related Questions

I want to develop JSF page which can display the swap size if the
Can someone tell me how to catch parameters passed from URI in JSF's managed
How can I show/hide component with JSF? I am currently trying so do the
I want to get current view HTML source and pass it to JSF managed
I have a question regarding Spring Web Flow with JSF: How can I teach
Core JavaServer Faces Third Edition mentions a case where JSF can go from the
I have an error page error.jsf mentioned in the web.xml : <error-page> <exception-type>javax.faces.application.ViewExpiredException</exception-type> <location>/viewExpired.jsp</location>
How can I check if a user is logged in using jsf? This is
How can I show/hide component with JSF? I am currently trying so do the
When I want to hide some content in JSF, what tag is made for

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.