Announcement Announcement Module
Collapse
No announcement yet.
Tiles2, how to set attribute from code? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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";
    }

    Comment

    Working...
    X