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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:17:54+00:00 2026-05-11T19:17:54+00:00

I am using struts 1.1 with tiles. I have tiles with definitions like <definition

  • 0

I am using struts 1.1 with tiles.

I have tiles with definitions like

<definition name="cnmp.body.index" extends="cnmp.mainLayout" >
  <put name="title"  value="CNM Portal" />
  <put name="bodytitle"  value="Home" />
  <put name="body"   value="/00-CNM_Landing.jsp" />
</definition>

I want to be able to set the value of the body parameter in my java Action class.
What would I get from the ActionMapping or ActionForm to do this?

public class TileForwardAction extends Action
{
public ActionForward execute(ActionMapping mapping, ActionForm arg1,
        HttpServletRequest arg2, HttpServletResponse arg3) throws Exception
{
    return mapping.findForward("theTile");           
}
}

the struts config file looks like

  <action-mappings>

  <action   path = "/index"
            type = "com.bellsouth.snt.cnmp.ui.action.TileForwardAction"
            scope = "request"
            input = "cnmp.body.index"
            parameter= "theTile"
    >    
      <forward name="theTile" path="cnmp.body.index"/>       
  </action>

Thank you


Inspired by the accepted answer I came up with the following solution

In the page defined in the tile def I have the following

<% String destAttr=(String)request.getAttribute("dest"); %>

<jsp:include page="<%=destAttr%>" flush="true" />

In the action class (because I was lazy) I have the following

    request.setAttribute("dest", "landingB.jsp");

And it worked.

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

    You might want to look into tiles support for Controller Classes. The tiles def entry would look something like this:

    <definition 
      name="cnmp.body.index" 
      extends="cnmp.mainLayout"
      controllerClass="org.yourpackage.YourControllerClass">
      <put name="title"  value="CNM Portal" />
      <put name="bodytitle"  value="Home" />
      <put name="body"   value="/00-CNM_Landing.jsp" />
    </definition>
    

    then the YourControllerClass would implement the perform() method like:

    public class YourControllerClasss implements Controller
        public void perform(ComponentContext context,
          HttpServletRequest request,
          HttpServletResponse response,
          ServletContext servletContext)
          throws ServletException, IOException {
    
          //some logic to determine what the 'body' should be
    
          if (service.isUp()){
            request.setAttribute("nameOfJSPToImport", "/jsps/import-me.jsp");
          }else{
            request.setAttribute("nameOfJSPToImport", "/jsps/import-me-instead.jsp");
          }
    
        }
    }
    

    The above example could be done directly in your action without use of TilesControllers, but the TilesController can help make your Actions less cluttered. The overall goal regardless of technique is to parameterize the NM_Landing.jsp then actually changing which jsp the “body” attribute of the definition is using. For example, NM_landing.jsp could be nothing more than include call something like

    <c:import url="${nameOfJSPToImport}" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Struts tiles. I have a header, menu and body. I want
I am using Struts Tiles with JSF to have one header, menu and footer
Using Spring Security 3 along with Struts 2 and Tiles 2, I have a
I am trying get Struts 2 and Tiles to work and I am using
I have started using struts .I have hanged in a place ,Code is bellow
I am using Struts and Java. The problem is that I have a page
I am using Struts 1.2.7 and have the standard servlet mapping that uses *.do
I'm using eclipse(galileo) and struts2 framework and tiles. It seems that modifying xml files(struts.xml,
I’m using Struts 2.2.3 with Tiles 2.1.4. It works absolutely fine, but now I’m
Using Struts 1.3. Submitting forms as a collection using the <logic:iterate> tag I'd like

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.