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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:26:25+00:00 2026-05-18T07:26:25+00:00

I had the idea a while back to put all of my taglib declarations

  • 0

I had the idea a while back to put all of my taglib declarations (uri’s, etc) in a common header file so I don’t have to manually write them into all of my JSPs. Initially, things seemed fine, although I don’t use the actual taglibs as much as just the simple EL syntax. However, I’m having trouble in all jsp files except for the one that explicitly has the taglibs declared. All of the other jsp’s (that include the header file) treat the <c:something.../> tag as if it’s HTML and don’t evaluate it. I did some googling and found this post on O’Reilly suggesting that what I’m trying to do can be done, but I’m clearly doing something wrong. What’s more is that the other stuff in the header file (common page headers, page titles, etc.) all show up fine. The header file and a sample of the inclusion are below.

Header file:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page session="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>

Inclusion statement:

<jsp:include page="/WEB-INF/jsp/include/header.jsp">
    <jsp:param name="title" value="Home" />
</jsp:include>
  • 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-18T07:26:25+00:00Added an answer on May 18, 2026 at 7:26 am

    This is expected behaviour.

    When you use <jsp:include>, it executed the target in a separate request, and then includes the output in the including JSP. It doesn’t include the source of the included target, it includes the output. The means by which that target output is generated is lost.

    To do what you’re trying to do, you need to use <% include %> directives:

    <%@ include file="/WEB-INF/jsp/include/header.jsp" %>
    

    This will incline the literal text of header.jsp into your page. Of course, by doing that, you can no longer pass parameters to it, so you’d need to set that as a page context attribute (e.g. using <c:set>… but of course you can’t use <c:set> until you’ve done your include…).

    Essentially, it’s not really worth the hassle. Taglib declarations are annoying boilerplate, but hard to get rid of.

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

Sidebar

Related Questions

I had an idea for a project a while back wherein I was going
I had an idea while I was working on some PHP code. Usually, if
I had the idea to write a matrix division in Haskell as Muliply A*
I had an idea for my first mobile application and I was thinking of
I had an idea that would require me be able to send and receive
I just had an idea, is that possible to protect my java sources (packed
I recently had an idea to create my own String class to make using
Hey guys i had an idea yesterday. Can you help me with this. Here
I was wondering if anyone had an idea as to why the code below
I am learning C# and WPF and had an idea for a little utility.

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.