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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:27:32+00:00 2026-05-24T08:27:32+00:00

I want to componentization my project by using struts2 tiles plug-in. The tiles.xml file

  • 0

I want to componentization my project by using struts2 tiles plug-in.
The tiles.xml file I have written is like this:

<tiles-definitions>
<definition name="indexBaseLayout" template="/indexBaseLayout.jsp">
    <put-attribute name="title" value="" />
    <put-attribute name="topBar" value="/topbar.action" />
    <put-attribute name="catalog" value="" />
    <put-attribute name="searchForm" value="" />
    <put-attribute name="main" value="" />
    <put-attribute name="footer" value="" />
</definition>
<definition name="regInput.tiles" extends="indexBaseLayout">
    <put-attribute name="title" value="注册" />
    <put-attribute name="main" value="/reg/input.action" />
</definition>
<definition name="regSuccess.tiles" extends="indexBaseLayout">
    <put-attribute name="title" value="注册" />
    <put-attribute name="main" value="/reg_success.jsp" />
</definition>
<definition name="index.tiles" extends="indexBaseLayout">
    <put-attribute name="title" value="主页" />
    <put-attribute name="main" value="/index.jsp" />
</definition>

And a part of struts.xml like this:

<package name="main" extends="struts-default" namespace="/">
    <action name="topbar" class="topBarAction">
        <result name="success">/topbar.jsp</result>
    </action>
</package>

As you see, I put some action urls in put-attribute value. I thought they would be executed as struts actions and display the returned result view. But the fact is that the tiles plugin recognize “xxxx.action” as a file: java.io.FileNotFoundException: The requested resource (/bookstore/topbar.action) is not available.
So is there any solution to insert an action’s result view into tiles layouts?

  • 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-24T08:27:33+00:00Added an answer on May 24, 2026 at 8:27 am

    As far as I know you can’t execute an action from a tiles definition.

    If you’re trying to perform some logic on this jsp prior to rendering on all the other tiles results, another solution might be to use some asynchronous jquery calls to a struts action using the json plugin or something similar.

    I’m not sure what your end goal is here, if you can describe what you’re shooting for perhaps I can help more.

    EDIT: further definition with using conditionals in a JSP

    In your tiles definition you would reference the JSP as normal:

    <definition name="indexBaseLayout" template="/indexBaseLayout.jsp">
        <put-attribute name="title" value="" />
        <put-attribute name="topBar" value="/topbar.jsp" />
        <put-attribute name="catalog" value="" />
        <put-attribute name="searchForm" value="" />
        <put-attribute name="main" value="" />
        <put-attribute name="footer" value="" />
    </definition>
    

    In the JSP you would base what renders on a struts tag conditional:

    <s:if test="%{#session.user != null && #session.user.Authenticated"}>
        Welcome <s:property value="%{#session.user.name}" />
    </s:if><s:else>
        <%-- Login form goes here --%>
    </s:else>
    

    This solution gives you a way to check for user object in session, which is where I would probably be maintaining a user info object personally. If the user object is null or the boolean authenticated is false, then it will show the log in form, otherwise it will show the welcome message and perhaps a logout button.

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

Sidebar

Related Questions

want to know why String behaves like value type while using ==. String s1
I want to loop over the contents of a text file and do a
I want to assign the decimal variable "trans" to the double variable "this.Opacity". decimal
I want to create a Java application bundle for Mac without using Mac. According
I want to reference a COM DLL in a .NET project, but I also
I want to log onto Stack Overflow using OpenID, but I thought I'd set
Want to edit things like DIV size, color, positioning (absolute), height/width etc.
want to query below xml <courseList filedUnder=Courses> <category code=4wd title=4wd Operation> <product code=lr title=4wd
Want to get current datetime to insert into lastModifiedTime column. I am using MySQL
want to have a Hyperlink-Button in a gridView in which I can display 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.