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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:40:22+00:00 2026-05-25T21:40:22+00:00

I will ilustrate my question using an example: outerfile.xhtml: <h:head> <h:outputScript library=js name=jquery-1.6.2.js />

  • 0

I will ilustrate my question using an example:

outerfile.xhtml:

<h:head>
    <h:outputScript library="js" name="jquery-1.6.2.js" />
    <h:outputScript library="js" name="outer.js" />
</h:head>

<h:body>
    <h:panelGroup id="inner_panel">
      <ui:include src="innerfile.xhtml" />
    </h:panelGroup>
</h:body>

innerfile.xhtml:

<ui:composition ... >
    <h:head>
        <h:outputScript library="js" name="jquery-1.6.2.js" />
        <h:outputScript library="js" name="inner.js" />
    </h:head>

    <h:body>
        <h:panelGroup>
          I Am Text in The Inner File!
        </h:panelGroup>
    </h:body>
</ui:composition>

My questions:

  1. Is it okay to declare the js files in the inner file the way I did?
  2. Do I need (And Should I) declare the common (jquery-1.6.2.js) again in the inner file?
  3. What happens if I un-render and the re-render inner_panel using AJAX? Will the inner-included headers be reloaded?
  • 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-25T21:40:23+00:00Added an answer on May 25, 2026 at 9:40 pm

    Is it okay to declare the js files in the inner file the way I did?

    No. You should not specify the <h:head> in the include as well. This would only result in invalid HTML. As you have right now will result in:

    <html>
      <head>
        <script></script>
      </head>
      <body>
        <head>
          <script></script>
        </head>
        <body>
        </body>
      </body>
    </html>
    

    (rightclick page in browser and do View Source to see it yourself, w3-validate if necessary)

    Fix it accordingly in innerfile.xhtml:

    <ui:composition ... >
        <h:outputScript library="js" name="jquery-1.6.2.js" target="head" />
        <h:outputScript library="js" name="inner.js" target="head" />
    
        <h:panelGroup>
            I Am Text in The Inner File!
        </h:panelGroup>
    </ui:composition>
    

    This will result in valid HTML. The scripts declared by <h:outputScript target="head"> will just end up in the <head> automatically, if not already declared before. Like as in real HTML, there should be only one <h:head> and <h:body> in the entire view, including any templates and include files.


    Do I need (And Should I) declare the common (jquery-1.6.2.js) again in the inner file?

    Not if the parent file has it already declared as <h:outputScript>. But redeclaring it in the include doesn’t harm. It won’t be duplicated anyway if it’s already been declared before.


    What happens if I un-render and the re-render inner_panel using Ajax? Will the inner-included headers be reloaded?

    This only works if you don’t use target="head". Whether they will be reloaded from the server, depends on whether it’s already been requested by the browser before and already present and valid in the browser cache. But basically, the browser will be told again to load it, yes. With Firebug you can easily determine it.

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

Sidebar

Related Questions

I will be using the following example to illustrate my question: class Attribute {}
I will use a simple example to illustrate my question. In Java, C, or
I will try and illustrate my question with examples, I am attempting to create
My question is not easy to explain using words, fortunately it's not too difficult
Hopefully, this fictitious example will illustrate my problem: Suppose you are writing a system
I'm writing a library in C# that I will later use for an application,
Best way to illustrate my question is with this example code: class Item {}
I am sorry if my question is not overly clear. I will first illustrate
I have a question about nHibernate and filtering. I am using nHibernate 2.2 but
Let me illustrate this question with a simplified example. Assume I am building a

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.