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

The Archive Base Latest Questions

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

Say I have my custom taglib: <%@ taglib uri=http://foo.bar/mytaglib prefix=mytaglib%> <%@ taglib uri=http://java.sun.com/jstl/core prefix=c%>

  • 0

Say I have my custom taglib:

<%@ taglib uri="http://foo.bar/mytaglib" prefix="mytaglib"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>

<mytaglib:doSomething>
  Test
</mytaglib:doSomething>

Inside the taglib class I need to process a template and tell the JSP to re-evaluate its output, so for example if I have this:

public class MyTaglib extends SimpleTagSupport {

  @Override public void doTag() throws JspException, IOException {
    getJspContext().getOut().println("<c:out value=\"My enclosed tag\"/>");
    getJspBody().invoke(null);
  }
}

The output I have is:

<c:out value="My enclosed tag"/>
Test

When I actually need to output this:

My enclosed tag
Test

Is this feasible? How?

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-15T16:37:23+00:00Added an answer on May 15, 2026 at 4:37 pm

    Tiago, I do not know how to solve your exact problem but you can interpret the JSP code from a file. Just create a RequestDispatcher and include the JSP:

        public int doStartTag() throws JspException {
        ServletRequest request = pageContext.getRequest();
        ServletResponse response = pageContext.getResponse();
    
        RequestDispatcher disp = request.getRequestDispatcher("/test.jsp");
        try {
            disp.include(request, response);
        } catch (ServletException e) {
            throw new JspException(e);
        } catch (IOException e) {
            throw new JspException(e);
        }
        return super.doStartTag();
    }
    

    I tested this code in a Liferay portlet, but I believe it should work in other contexts anyway. If it don’t, I would like to know 🙂

    HTH

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

Sidebar

Related Questions

Let's say I have custom HTML tags like so: <fb:est hours=5>5 Hours</fb:est> <fb:act hours=4>4
Lets say I have a custom collection and a custom object that have a
Let's say we have a custom backup service that follows the rsync approach suggested
Let's say I have and custom STS which authenticates users of a web app.
How can I have custom pages for each row of an sql table? Without
I'm working on a Legacy ASP.NET system. I say legacy because there are NO
I've examined various questions about taglibs and implicit objects here. While many of the
I'm torn how to structure my code to accommodate business rules specific to instances
Ok this is probably just me not knowing enough about php but here it
As I've found recently, setting width / height properties on a Sprite only forces

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.