On 31/01/2009, at 6:23 AM, Tom Pop wrote:

Hello,

please, can you show me on this example how to convert tiles from struts1 to struts2?

This example defines localized page title attribute passed to template in struts1:

<bean:define id="messages" name="<%= org.apache.struts.Globals.MESSAGES_KEY %>" type="org.apache.struts.util.MessageResources"/> <bean:define id="locale" name="locale" type="java.util.Locale" scope="session" />
<%
        String docTitle = messages.getMessage(locale, "page.title");
%>
<tiles:insertDefinition name="layout-main">
<tiles:putAttribute name="document-title" value="<%= docTitle %>" />
</tiles:insertDefinition>


Tiles2 is used the same way in Struts 2 as in Struts 1. Include the tiles dependencies and its listener and the insertDefintion tag will work within a JSP as you'd expect. Include the tiles plugin for improved integration (eg. tiles result type).

What you DO need to change in your example is the use of bean:define and the inline scriptlet which are unrelated to Tiles and unnecessary in Struts 2. Reading one of the articles about upgrading from Struts 1 to Struts 2 will help you understand this (plus the Struts2 pages on i18n).

Hope that helps,
Jeromy Evans

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to