2011/4/11 Daniel Stefaniuk <[email protected]>

> I should simplify the example:
>
> *TitleHelper.java*
>
> public interface TitleHelper {
>     void setTitle(String title);
>     String getTitle();
> }
>
> *content.jsp*
>
> <%
>     TitleHelper th = (TitleHelper) request.getAttribute("th");
>     th.setTitle("My View");
> %>
> <div>
>     This is a content of a view.
> </div>
>
> *layout.jsp*
>
> <html>
> <head>
>  <%
>     TitleHelper th = new TitleHelperImpl();
>     // in the real world complicated state of TitleHelper is assigned here
>
>     request.setAttribute("th", th);
> %>
>     <title><%= th.toString %></title>
>
> </head>
>  <body>
>     <tiles:insertAttribute name="content" />
>  </body>
> </html>
>
> I hope now it is clear what I meant.
>

So you want that a JSP file changes code of an already outputted variable
and you expect it changes? I bet it does not work! :-D
What you want to do is impossible, independently to Tiles, JSP or whatever
template engine you use: if it is written to output it cannot ever change
(at least server-side).

Try to explain what is your use case in plain words so we can try to sort it
out.

Antonio

Reply via email to