Sam
Sam

Reputation: 97

How to use a tiles variable in JSP page

I have a variable defined in Tiles. I want to use that variable in JSP page.

I tried using

<tiles:put name="title"><tiles:getAsString name="title" /></tiles:put> 

but I am not able to assign the value in some var in JSP page. Depending on the variable I need to implement some logic in JSP page. How to do this?

Upvotes: 2

Views: 986

Answers (1)

Roman C
Roman C

Reputation: 1

Use some definition in tiles-defs.xml:

<definition name="title.tile" >
    <put-attribute name="title" value="Some Title" type="string"/>
</definition>

Now in the tile you can use

<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<html>
<head>
<title><tiles:getAsString name="title" /></title>

Upvotes: 3

Related Questions