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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:01:05+00:00 2026-05-22T23:01:05+00:00

What is the best way to enable my webapplication to use JSF files stored

  • 0

What is the best way to enable my webapplication to use JSF files stored in the database?
I’d like to be able to dynamically (during runtime) create new JSF pages which will be made available without having to redeploy the application.

So in other words: I would like to store the bigger part of my JSF pages in the database and would like JSF to use the database as a datasource for getting JSF files.

I’ve thought long about a solution and found some possible ways. However, I haven’t been able to implement either of them.

  1. Whenever a new page has to be added/removed: manipulate the files in the classpath (e.g. remove or add a file to the .war file)
  2. Extending the classpath of the webapplication so it will be able to get files from an at runtime defined location (i.e. /tmp or directly using a database connection)
  3. Provide JSF with a way to find resources another way ( this doesn’t seem possible? )

My environment:

  • Java SE 6
  • Jetty as servlet container
  • Mojarra as jsf implementation

Now, my question:

Is it possible for someone to let JSF find pages at a location other than the default classpath, preferably the database?

Any response is greatly appreciated!

  • 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-22T23:01:06+00:00Added an answer on May 22, 2026 at 11:01 pm

    1: Whenever a new page has to be added/removed: manipulate the files in the classpath (e.g. remove or add a file to the .war file)

    This is definitely possible if the WAR is expanded. I am not sure about Jetty, but it works for me with Mojarra 2.x on Tomcat 7 and Glassfish 3. Just writing the file to the expanded WAR folder the usual Java IO way suffices.

    File file = new File(servletContext.getRealPath("/foo.xhtml"));
    
    if (!file.exists()) {
        OutputStream output = new FileOutputStream(file);
    
        try {
            output.write(bytes); // Can be bytes from DB.
        } finally {
            output.close();
        }
    }
    

    This needs to be executed before the FacesServlet kicks in. A Filter is a perfect place. See also this related answer:

    • How to create dynamic JSF form fields

    2: Extending the classpath of the webapplication so it will be able to get files from an at runtime defined location (i.e. /tmp or directly using a database connection)

    You can package Facelets files in a JAR file and put it in the classpath and provide a Facelets ResourceResolver which serves the files from the JAR on when no match is found in WAR. You can find complete code examples in the following answers:

    • how to share a jsf error page between multiple wars
    • How to create a modular JSF 2.0 application?

    3: Provide JSF with a way to find resources another way ( this doesn’t seem possible? )

    You’ve plenty of play room in the custom ResourceResolver.

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

Sidebar

Related Questions

What is the best way to SSL enable a SharePoint farm? I'm thinking ISA,
What is the best way to enable log rotation on a Ruby on Rails
When I need to disable/re-enable validator I usually use jQuery code like so: ValidatorEnable($('[id*=DueDateRequiredValidator]')[0],
What is the best way to enable/disable a junit test based on a Config
What's the best way to enable dynamic skinning of a WPF Application when some
What is the way(rather the best way) to enable FB-login for dynamic subdomains? Suppose
Best way to match 2 pages for Google analytics. Pages to Query: 1.) this_google.html
The best way I think to explain this is to tell you what my
The best way to explain my problem is by a example. I have a
Any best way to run the jasmine HTML reporter with browserify styled code? 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.