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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:24:37+00:00 2026-05-27T17:24:37+00:00

Is it possible to put JSF2 Facelets files with common content into a JAR

  • 0

Is it possible to put JSF2 Facelets files with common content into a JAR to use it from other web applications inside e.g. <ui:composition template>, <ui:include src>, <cc:implementation>, etc? If yes, how can I achieve this? Is some extra configuration necessary?

  • 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-27T17:24:38+00:00Added an answer on May 27, 2026 at 5:24 pm

    You can put common resources in the /META-INF/resources folder of the JAR which is to be treated like as /WEB-INF/resources folder of the WAR.

    E.g.

    CommonWebProject
     |-- META-INF
     |    |-- resources
     |    |    `-- common
     |    |         |-- css
     |    |         |    `-- some.css
     |    |         |-- js
     |    |         |    `-- some.js
     |    |         |-- images
     |    |         |    `-- some.png
     |    |         |-- components
     |    |         |    `-- somecomposite.xhtml
     |    |         |-- someinclude.xhtml
     |    |         `-- sometemplate.xhtml
     |    |-- faces-config.xml
     |    `-- MANIFEST.MF
     :
    

    The resources of the JAR are then available as follows:

    <... xmlns:common="http://xmlns.jcp.org/jsf/composite/common/components">
    <h:outputStylesheet library="common" name="css/some.css" />
    <h:outputScript library="common" name="js/some.js" />
    <h:graphicImage library="common" name="images/some.png" />
    <common:somecomposite />
    <ui:include src="/common/someinclude.xhtml" />
    <ui:composition template="/common/sometemplate.xhtml" />
    ...
    

    If you want to trigger the JSF2 annotation scanner as well so that you can put @ManagedBean, @FacesValidator, @FacesConverter and consorts in that project as well, then create a JSF2 compatible /META-INF/faces-config.xml file:

    <?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">
    </faces-config>
    

    The Facelets resource resolver is only necessary if the resources are not in /META-INF/resources for some reason, or when you’re not using Servlet 3.0 but 2.5, or when you’re using an early JBoss/JSF version which has bugs in META-INF resource resolving. See also How to create a modular JSF 2.0 application? for a concrete example.

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

Sidebar

Related Questions

Is it possible to put Entity inside of a nested folder/package and still use
Is it possible to put the results from more than one query on more
Possible Duplicate: How many Python classes should I put in one file? Coming from
I need create custom dialog and put JPanel into it. Is it possible?
Is it possible to put some data into gnuplot right on it's prompt? Like
Is it possible to put UIPickerView into UIAlertView?If yes, can you give an example?
Is it possible to put a canvas inside of a ListBox using WPF?
Is it possible to put comments into Hibernate Query Language? If so, how?
Is it possible to put another scrollview inside a scrollview?? because in one page
Is it possible to put this code $left_Nickels = 20; Inside any conditional and

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.