Results 1 to 2 of 2

Thread: Tiles2, how to set attribute from code?

  1. #1
    Join Date
    Feb 2010
    Posts
    1

    Default Tiles2, how to set attribute from code?

    Hi everyone,

    I am using Spring 2.5 and Tiles2. I have a function testing project, but I don't know how can I set attribute from spring controller class. For example:

    Tiles definitions:

    Main layout:
    HTML Code:
    <title><tiles:insertAttribute name="title"/></title>
    <body><tiles:insertAttribute name="testPage"/></body>
    Test page:
    HTML Code:
    <h1>heading</h1>
    <p>text..</p>
    Between tag title will be putted title from tiles definition file as a value and content of the test page will be added between <body> and </body>. It is ok, but I don't know what will be between <title> and </title>

    I want get data from database and then (in some Controller for example) set some text as a title. Is it possible?

    Thanks

  2. #2
    Join Date
    Jul 2008
    Posts
    157

    Default

    Isn't it possible to use something like
    Code:
    <title>${title}</title>
    and the in your controller something like
    Code:
    @ModelAttribute("title")
    public String getTitle() {
    	return "Custom Title";
    }

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •