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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:33:32+00:00 2026-06-13T05:33:32+00:00

I want to add namespaces in my struts2 configuration and I use tiles. A

  • 0

I want to add namespaces in my struts2 configuration and I use tiles.

A package of my struts.xml for example :

<package name="search" namespace="/search" extends="struts-default"> 
<result-types>
    <result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<action name="SearchActionInit"  class="web.action.SearchAction" method="initSearch"> 
   <result name="input" type="tiles">search</result> 
   <result name="success" type="tiles">search</result> 
</action> 
</package>

And the corresponding tiles configuration :

<definition name="baseLayout"    template="layout.jsp">
    <put-attribute name="titre"               value="titre.default" />
    <put-attribute name="header"            value="/common/header.jsp" />
    <put-attribute name="menu"          value="/common/menu.jsp" />
    <put-attribute name="leftcontent"          value="/common/leftcontent.jsp" />
    <put-attribute name="rightcontent"          value="/common/rightcontent.jsp" />
    <put-attribute name="detail"          value="/common/detail.jsp" />
    <put-attribute name="footer"               value="/common/footer.jsp" />
</definition>

<definition name="search"    extends="baseLayout">
    <put-attribute name="titre"               value="titre.search" />
    <put-attribute name="rightcontent"          value="/pages/search/Search.jsp" />
</definition>

The problem I have is that I need to duplicate the layout.jsp in a search folder for the namespace search (and so on for the other namespaces). It’s not in the tiles logic and will bring more effort to maintain.

Has anybody a key to this problem to avoid duplication?

  • 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-06-13T05:33:33+00:00Added an answer on June 13, 2026 at 5:33 am

    try this:

    template:

    <!-- meta template -->
    <definition name="global" template="/WEB-INF/template/layout.jsp">
        <put-attribute name="attr1" value="/WEB-INF/template/attr1.jsp"/>
        <put-attribute name="attr2" value="/WEB-INF/template/attr2.jsp"/>
        <!-- more -->
    </definition>
    

    then the data:

    <!-- instance -->
    <definition name="myApp.search" extends="global">
        <put-attribute name="attr2" value="/jsp/search/search.jsp"/>
    </definition>
    <!-- instance -->
    <definition name="myApp.page2" extends="global">
        <put-attribute name="attrN" value="/jsp/namespaceN/whatever.jsp"/>
    </definition>
    

    You need only overwrite the part of the page layout.jsp, which you’d like to load.

    here is my project structure:

    Root
    |
    --jsp
        |
        namespace1
            |
            --*.jsp
        |
        --*.jsp
    |
    --WEB-INF
        |
        --template
            |
            --layout.jsp
            |
            --attr1.jsp
    

    I hope this solves your problem.

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

Sidebar

Related Questions

Summary: I want to save two classes of the same name and different namespaces
I'm new in struts2 and I want to add i18n in my web application.
Say I have a lot of c++ files that I want to add namespace
I want to add a class library the uses he System.Windows.Forms namespace to my
I'm building an WPF (C#) application and I want to add a namespace to
I want to add a variable list of parameters to a Struts2 URL tag.
I have an XML document with un-namespaced elements, and I want to use XSLT
I'm not sure if namespaces are required for valid/correct XML. Can I add arbitrary
I want add UIGestureRecognizerDelegate to UIWebView,but failed. if [self.view addsubView:webView]; So UIWebView is ok,but
I want add new Feed item on entity persist and update. I write this

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.