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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:37:25+00:00 2026-05-15T15:37:25+00:00

I have some .jspf files that are fragments which I include in a new

  • 0

I have some .jspf files that are fragments which I include in a new .jsp file. The reason they are fragments is that they are reused across multiple jsps with some additional components.

My issue now is that I want to use these .jsps in 2 different .war files.

So I created a new .jar file which includes these jspf, now I am trying to deploy this jar so that I am then import it in my new jsp which is inside 1 of the 2 wars.

I am not able to deploy the jar succesfully in Jboss 4.2. I am using Eclipse ide.
Any ideas on this? If there is an alternate approach I would appreciate any ideas.


Thanks for this suggestion, I have followed this idea and deployed my war1 which contains my .jspf files.

So in my war2 on a jsp I do:

    <c:import context="/sharedComponents" url="/easyPayNamePaymentOption.jspf" var="easyPayName"/>

<%@ include file="easyPayNamePaymentOption.jspf" %>

However I am not able to render this page with the included fragment, I am not sure how to address the imported jspf. I ahve tried several different ways like:

<%@ include file="/sharedComponents/easyPayNamePaymentOption.jspf" %>

and also using var name like:

<%@ include file="#{easyPayName}" %>

However it keeps looking inside the current war. How can I tell it to include the newly imported fragment and display it?

Thanks in advance.

  • 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-15T15:37:26+00:00Added an answer on May 15, 2026 at 3:37 pm

    I can see what you’re trying to do, but this isn’t going to work with a JAR file. All JSP files (including JSPF) have to inside a WAR, not a JAR.

    The simplest solution is to put copies of the JSPF files into each WAR that needs to use them. Assuming that you don’t want to do this, then there is an alternative, called a cross-context WAR.

    By default, JBoss allows its webapps to request resources from each other. For example, say webapp1 (context path /app1) wants to import JSPF /my.jspf from webapp2 (context path /app2). You can use JSTL to do this, from inside webapp1:

    <c:import context="/app2" url="/my.jspf"/>
    

    So if you were to create a “shared” WAR file containing your JSPF files, and deployed this to JBoss, then your other webapps could use the above technique to include the contents of the JSPFs into their own JSPs.


    edit: I’ve read your updated question, and I don’t understand why you added var="easyPayName" to the <c:import> tag. All that’s doing is importing the contents of easyPayNamePaymentOption.jspf and storing it in a variable called easyPayName, which seems completely unnecessary.

    I think perhaps you’re associating <c:import> with a java import? If so, don’t – they’re completely different. <c:import> should really have been called <c:include>, because that’s what it does.

    Just keep it simple, remove the attribute, and just have

    <c:import context="/sharedComponents" url="/easyPayNamePaymentOption.jspf"/>
    

    That’s all you need to do – it will include the content of easyPayNamePaymentOption.jspf directly in the JSP.

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

Sidebar

Related Questions

I have some files that are uuencoded, and I need to decode them, using
I have some ASP.NET web services which all share a common helper class they
Have some audio and video files that users are to download, however depending on
Have some text files that I need to break out the individual words. But
I have some data in array format which I wrote to a file in
I have some files stored at amazon. all in private mode, and since I
I have some script in my default page that redirects users to language specific
I have some Java code which performs bitwise operations on a BitSet. I have
I have some XML which contains records and sub records, like this: <data> <record
I have some jquery code that is doing an ajax lookup and returning comma

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.