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?
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>