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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:55:30+00:00 2026-05-28T13:55:30+00:00

I am converting an existing Tiles 1 webapp to Tiles 2 architecture. I am

  • 0

I am converting an existing Tiles 1 webapp to Tiles 2 architecture. I am having trouble passing values from JSP page to tiles attributes.

Here is my tiles definition file (tiles-definition.xml)

<tiles-definitions>

    <definition name="cda.layout" template="/jsp/layouts/layout.jsp">
        <put-attribute name="pageTitle" value="StoryTitle" type="string"/>
        <put-attribute name="pageHeader" value="StoryHeader" type="string"/>
        <put-attribute name="resources" value="" type="string"/>
    </definition>

</tiles-definitions>

The layout.jsp looks like:

<html>
    <head>
    <title><tiles:insertAttribute name="pageTitle" flush="true"/></title> 
    </head>

    <body>
    ...
    ...

    <div class="content">
    <h1><tiles:insertAttribute name="pageHeader" flush="true"/></h1>
    </div>

    ...
    ...
    </body>
</html>

I have a story page which uses the layout and need to pass values to template attributes.

    <%
    // create a business object and populate
    String mytitle= story.getTitle();
    String myheader = story.getHeader();
    %>

<tiles:insertTemplate template="../layouts/layout.jsp"  flush="false" >
    <tiles:putAttribute name="pageTitle" value="${mytitle}"/>
    <tiles:putAttribute name="pageHeader"value="${myheader}"/>
</tiles:insertTemplate>

In the story.jsp, I can System.out.print() the values for mytitle, myheader and they are showing correct. But, these values are NOT passed on to the tile attributes.

Any idea how to fix this?

  • 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-28T13:55:31+00:00Added an answer on May 28, 2026 at 1:55 pm

    ${mytitle} is a JSP EL expression which means: find an attribute in page scope, or request scope, or session scope, or application scope, named “mytitle”.

    By defining a scriptlet variable, you haven’t defined an attribute in any of these scopes. It would work if you had

    pageContext.setAttribute("mytitle", mytitle);
    

    But using scriptlets in JSPs is bad practice. I don’t know where your story bean comes from, but it’s probably a request attribute. If so, you can define a new page-scope attribute this way, using the JSTL:

    <c:set var="mytitle" value="${story.title}"/>
    

    This is unnecessary though, since you could use this expression directly in the tiles tag:

    <tiles:putAttribute name="pageTitle" value="${story.title}"/>
    

    Read more about the JSP EL in this tutorial.

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

Sidebar

Related Questions

I'm converting an existing iOS application from Objective-C to RubyMotion. The first major pitfall
I'm converting an existing program to C++ and here need to manipulate Sybase timestamps.
Converting to ODB.NET from System.Data.OracleClient and need help converting my connection string. Here is
I´m busy converting an existing project from an Ant build to one using Maven.
I'm converting existing database driven application from D7 to D2009, therefore I won't be
I'm finding surprisingly little information on converting an existing database from Encrypted passwords to
I am converting from existing CVS repository to SVN repository. CVS repository has few
I've been tasked with converting an existing ASP.NET site from using InProc session management
In the process of converting a page from normal postbacks to AJAX-calls (using JavaScript
I'm converting an existing codebase to build via Maven. I set up my dependencies

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.