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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:34:33+00:00 2026-06-01T21:34:33+00:00

I have jsp page inside which am calling my xhtml page. Am mapping xhtml

  • 0

I have jsp page inside which am calling my xhtml page. Am mapping xhtml to facesServlet and have all resource servlet active so it maps all js and css file fine, if i hit xhtml page.

If I hit jsp page then those files are not referenced firebug pops out all sorts of js errors.

To work around, i added js and css files to web folder and am including and tried them including in xhtml as well as jsp page but those are not referenced and as of now, if i directly hit xhmtl page then file upload works fine but if i go and hit jsp page then end up getting js errors, is there any other way of getting js file included.

Here is how am referencing my js files

<%@ include file="/common/taglibs.inc" %>

<html>
<head>
    <link rel="stylesheet" href="/css/Main.css" type="text/css">
    <link rel="stylesheet" href="/css/Admin.css" type="text/css">
    <link rel="stylesheet" href="/css/Home.css" type="text/css">
    <script type="text/javascript" src="/js/icefaces/ace-jquery.js"/>
    <script type="text/javascript" src="/js/icefaces/ace-components.js"/>
    <script type="text/javascript" src="/js/icefaces/icepush.js"/>
    <script type="text/javascript" src="/js/icefaces/bridge.js"/>
    <script type="text/javascript" src="/js/icefaces/compat.js"/>
    <script type="text/javascript" src="/js/icefaces/fileEntry.js"/>
    <script type="text/javascript" src="/js/icefaces/jsf.js"/>
    <script type="text/javascript" src="/js/icefaces/icefaces-compat.js"/>


    <!-- BEGIN SCRIPT TO OPEN RIGHT NOW HELP POPUP, THIS SCRIPT INCLUDES THE FUNCTION OPENRN-->
    <
    %@ include file="/js/popupRightNow.inc" %>

    <!-- END SCRIPT TO OPEN RIGHT NOW HELP POPUP, THIS SCRIPT INCLUDES THE FUNCTION OPENRN-->

    <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<jsp:include page="/navigation/TopNav.jsp" flush="true"/>

<jsp:include page="/trade_entry/UploadBlotter.xhtml"/>


<!--BEGIN BOTTOM NAV -->
<jsp:include page="/navigation/BottomNav.jsp" flush="true"/>
<!--END BOTTOM NAV -->
</body>
</html>

Any thoughts, suggestions?

Update:

I have requirement of creating new pages using jsf2 and i have created xhtml page but i want to get my application header and footer themes and those are defined in jsp now I tried looking for integrating jsp into xhtml but it was rightly suggested that one must not do it.

Tried How to include a JSP page in a Facelets page? but that didn’t work either as my tags were not recognized and so finally tried creating jsp page and included xhtml page inside it and that seemed to work but not 100%.

So as it stands right now if i hit xhtml page directly then it works but if i hit jsp page with header/footer information then icefaces or say jsf stuffs doesn’t work 100%, hope am able to clarify what am trying to achieve.

Update 2

js file from javax.faces.resources are referenced fine on xhtml page but are not referenced on jsp page.

  • 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-01T21:34:35+00:00Added an answer on June 1, 2026 at 9:34 pm

    It’s the webbrowser who has got to download those JS/CSS files. It’s not the server who has got to load/include those JS/CSS files.

    So, the path which you specified in src and href attributes are resolved relative to the current request URL as you see in browser’s address bar. They are not resolved relative to the location of the JSP file in the public webcontent.

    So, if you happen to have a context path in the request URL like so

    http://localhost:8080/somecontextpath/page.jsp

    then for example your <link href="/css/Main.css"> would be downloaded by the webbrowser from the following URL

    http://localhost:8080/css/Main.css

    while it should actually have been

    http://localhost:8080/somecontextpath/css/Main.css

    Fix it accordingly.

    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/Main.css" type="text/css">
    

    Or if you’re using Facelets

    <link rel="stylesheet" href="#{request.contextPath}/css/Main.css" type="text/css">
    

    Or if you’re using JSF 2 <h:outputStylesheet> (and <h:outputScript> components)

    <h:outputStylesheet name="css/Main.css" />
    

    (and put the /css and /js folders in /resources subfolder of public webcontent)


    By the way, the following line makes absolutely no sense:

    <jsp:include page="/trade_entry/UploadBlotter.xhtml"/>
    

    You’re mixing view technologies here. You can’t include the one in the other. Facelets is the successor of JSP. Use the one or the other. You can mix them in 1 webapp, but not in 1 view.

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

Sidebar

Related Questions

I have a jsp page which needs a java code. This java code inside
In my jsp page I have an javascript function inside which I have a
I have a JSP page, which accepts user strings in more than 23 languages.
I have a JSP page which accepts SQL queries, performs them then returns the
I have the following function call inside a jsp page. jQuery(function($){ $(#product).mask(99/99/9999,{placeholder: }); });
I am using Struts1.3, I have Jsp page which is showing the list of
Here is a problem I have encountered. I have jsp page which has a
i read that inside the webserver a jsp page is converted to a servlet.
Inside my jsp page, I have a string I want to show, but it
I have the following scriptlet inside a JSP page. File f = new File(//WEB-INF//music//rock//Evanascence//Fallen//text.txt);

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.