Thanks Enrico. Nope that’s for definitions I am not even there yet just trying to get the simple tiles working first.

 

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Enrico Goosen
Sent: Friday, January 06, 2006 12:15 PM
To: [email protected]
Subject: [CTJUG Forum] Re: Struts and tiles

 

Hi Leon,

 

Its been a while since I’ve worked with Struts, but looking at my web.xml and struts-config.xml, it appears that I’ve done it differently.

 

Web.xml:

<!-- Action Servlet Configuration -->

    <servlet>

        <servlet-name>action</servlet-name>

        <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

 

        <init-param>

            <param-name>config</param-name>

            <param-value>/WEB-INF/struts-config.xml</param-value>

        </init-param>

        <load-on-startup>1</load-on-startup>

    </servlet>

 

Struts-config.xml:

<plug-in className="org.apache.struts.tiles.TilesPlugin">

        <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml"/>

    </plug-in>

 

Try that and see if it works.

 

Enrico


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Leon van der Merwe
Sent: 06 January 2006 11:50 AM
To: [email protected]
Subject: [CTJUG Forum] Struts and tiles

 

I am trying to get tiles working in struts.

 

I have added the uri to web.xml:

 

<taglib>

    <taglib-uri>/tags/struts-tiles</taglib-uri>

    <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>

  </taglib>

 

then added it to struts-config.xml:

 

<plug-in className="org.apache.struts.tiles.TilesPlugin" >

 

      <!-- Path to XML definition file -->

      <set-property property="definitions-config"

                       value="/WEB-INF/tiles-defs.xml" />

      <set-property property="definitions-parser-validate"

                       value="true" />                  

      <!-- Set Module-awareness to true -->

      <set-property property="moduleAware" value="true" />

    </plug-in>

 

 

created a masterLayout.jsp

<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

 

<html>

    <head>

        <title>

            <tiles:getAsString name="title"/>

        </title>

    </head>

    <body>

        <p>

        <tiles:insert attribute="header" />

        <tiles:insert attribute="content" />

        <tiles:insert attribute="footer" />

    </body>

</html>

 

 

created each tile(jsp):

header.jsp

<%@ page language="java" %>

<%@ taglib uri="/tags/struts-bean" prefix="bean" %>

<%@ taglib uri="/tags/struts-html" prefix="html" %>

<%@ taglib uri="/tags/struts-logic" prefix="logic" %>

<%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>

 

<table border="1">

            <tr>     

                        <td>

                                    This is my header

                        </td>

            </tr>

</table>

 

content.jsp

<%@ page language="java" %>

<%@ taglib uri="/tags/struts-bean" prefix="bean" %>

<%@ taglib uri="/tags/struts-html" prefix="html" %>

<%@ taglib uri="/tags/struts-logic" prefix="logic" %>

<%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>

 

<table border="1">

            <tr>     

                        <td>

                                    This is my content

                        </td>

            </tr>

</table>

 

footer.jsp:

<%@ page language="java" %>

<%@ taglib uri="/tags/struts-bean" prefix="bean" %>

<%@ taglib uri="/tags/struts-html" prefix="html" %>

<%@ taglib uri="/tags/struts-logic" prefix="logic" %>

<%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>

 

<table border="1">

            <tr>     

                        <td>

                                    This is my footer

                        </td>

            </tr>

</table>

 

then my actual page:

<%@ page language="java" %>

<%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>

 

<tiles:insert page="/WEB-INF/pages/masterTemplate.jsp" flush="true" >

    <tiles:put name="title" value="Login Page" />

    <tiles:put name="header" value="/WEB-INF/pages/header.jsp" />

    <tiles:put name="content" value="/WEB-INF/pages/content.jsp" />

    <tiles:put name="footer" value="/WEB-INF/pages/footer.jsp" />

</tiles:insert>

 

 

I haven’t declared any definitions yet cause just want to get it working first.

 

Getting no errors and just a blank page…

 

Leon van der Merwe

Programmer

Bytes Specialised Solutions

 


Tel : (+27) (21) 590-9801
Fax : (+27) (21) 590-9999

Email :
[EMAIL PROTECTED]
Web : www.btgroup.co.za
Press Office : www.itweb.co.za/office/bytes

A division of Bytes Technology Group SA (Pty) Ltd : Registration No: 2003/027603/07
A member of Bytes Technology Group Ltd; In association with KAGISO
P O Box 13287, N1 City, 7463; Akker Park, Neels Bothma Street, N1 City, 7463, Cape Town, South Africa

E-Mail Disclaimer: http://www.altron.co.za/email.asp or phone: (+27) (11) 645-3600

 

Reply via email to