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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:26:36+00:00 2026-05-16T18:26:36+00:00

I’m developing a Struts2 application that uses Sitemesh as template engine. What I need

  • 0

I’m developing a Struts2 application that uses Sitemesh as template engine. What I need is a list of all the templates (JSP) that are used by request.

In other projects I use Django Framework, with it I’ve this amazing Debug Toolbar that, besides many other useful info, provides me with the list of templates the request used for displaying the page.

Django Debug Toolbar - Template Section

This list is surprisingly helpful when in have more than 600 templates that forms a intricate template web and I need to change a <br /> to a <p></p> in one of them.

Well I don’t expect anything as nice as this for Struts2, just a raw list of LOG.debug(<template>); will make my work so much easier.

  • 1 1 Answer
  • 1 View
  • 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-16T18:26:36+00:00Added an answer on May 16, 2026 at 6:26 pm

    Ok, I read some stuff and made the following class:

    package x;
    
    import java.util.Map;
    
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    import org.apache.struts2.ServletActionContext;
    
    import com.opensymphony.xwork2.ActionInvocation;
    import com.opensymphony.xwork2.config.entities.ResultConfig;
    import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
    import com.opensymphony.xwork2.interceptor.PreResultListener;
    
    public class TemplatesDebugInterceptor extends AbstractInterceptor {
    
        private static final long serialVersionUID = 4030044344066761593L;
        Log log = LogFactory.getLog(TemplatesDebugInterceptor.class);
    
        @Override
        public String intercept(ActionInvocation invocation) throws Exception {
            try {
                if (ServletActionContext.getActionMapping() != null) {
                    String className = invocation.getAction().getClass().getCanonicalName();
                    String methodName = ServletActionContext.getActionMapping().getMethod();
                    log.info("===========================");
                    log.info(className+"."+methodName);
                }
                invocation.addPreResultListener(new PreResultListener() {
                    public void beforeResult(ActionInvocation invocation,String resultCode) {
                        Map<String, ResultConfig> resultsMap = invocation.getProxy().getConfig().getResults();
                        ResultConfig finalResultConfig = resultsMap.get(resultCode);
                        log.info(finalResultConfig.getParams());
                    }
                });
            } catch (Exception e) {
                log.error("[ERROR] Could not list templates: ", e);
            }
            return invocation.invoke();
        }
    }
    

    Added this to struts.xml:

    <interceptors>
        <interceptor name="templates" class="x.TemplatesDebugInterceptor" />
        (...)
        <interceptor-stack name="defaultStackBizgov">
            <interceptor-ref name="templates"/>
            (...)
    

    And it’s done!:

    13:52:00,279 INFO  [STDOUT] [INFO] (http-0.0.0.0-8080-7) TemplatesDebugInterceptor - x.ProcedureDetailsAction.validateSubmitPublication
    13:52:00,357 INFO  [STDOUT] [INFO] (http-0.0.0.0-8080-7) TemplatesDebugInterceptor - {location=/WEB-INF/jsp/indexPage.jsp}
    13:52:00,763 INFO  [STDOUT] [INFO] (http-0.0.0.0-8080-7) TemplatesDebugInterceptor - {location=/WEB-INF/jsp/publicationView.jsp}
    

    I will update this post if I find out some extra useful output.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters
I am doing a simple coin flipping experiment for class that involves flipping a

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.