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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:39:50+00:00 2026-05-17T23:39:50+00:00

How do you extend an existing JSP custom tag? As you know, a custom

  • 0

How do you extend an existing JSP custom tag?

As you know, a custom tag consists of two parts, an implementation class and a TLD file. I can extend the parent custom tag’s class, but how do you “extend” its TLD file? One obvious solution is to cut and paste it and then add my stuff, but I wonder if there’s a more elegant solution like the way you extend a tiles definition in Apache Tiles.

Thanks.

  • 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-17T23:39:51+00:00Added an answer on May 17, 2026 at 11:39 pm

    I don’t think you can extend an existing tag, but a similar approach is to use a common abstract superclass for two tag implementation classes:

    // define repetitive stuff in abstract class
    public  abstract class TextConverterTag extends TagSupport{
    
        private  final long serialVersionUID = 1L;
        private String text;
    
        public String getText(){
            return text;
        }
    
        public void setText(final String text){
            this.text = text;
        }
    
        @Override
        public final int doStartTag() throws JspException{
            if(text != null){
                try{
                    pageContext.getOut().append(process(text));
                } catch(final IOException e){
                    throw new JspException(e);
                }
            }
            return TagSupport.SKIP_BODY;
        }
    
        protected abstract CharSequence process(String input);
    
    }
    
    // implementing class defines core functionality only
    public  class UpperCaseConverter extends TextConverterTag{
        private  final long serialVersionUID = 1L;
    
        @Override
        protected CharSequence process(final String input){
            return input.toUpperCase();
        }
    }
    
    // implementing class defines core functionality only
    public  class LowerCaseConverter extends TextConverterTag{
        private  final long serialVersionUID = 1L;
    
        @Override
        protected CharSequence process(final String input){
            return input.toLowerCase();
        }
    }
    

    But I’m afraid you will have to configure each tag class separately, as I don’t think there are abstract tag definitions in taglibs.

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

Sidebar

Related Questions

How do I create a custom attribute to extend existing Authorize attribute in MVC?
In Javascript, you can extend existing classes by using its prototype object: String.prototype.getFirstLetter =
I have an existing application in C++ with a custom ArrayBase class that manages
I want to extend an existing application I made to make it set mixer
I'm trying to extend some base classes in Python: class xlist (list): def len(self):
I want to extend the basic ControlCollection in VB.NET so I can just add
I am planning to extend the basic html input tag provided by Spring to
is it possible to extend vim functionality via custom extension (preferably, written in Python)?
Can we extend the Team Site to host our own pages. i.e. Does TFS
How do I extend my parent's options array for child classes in PHP? I

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.