Here is an example:

This is a xtestTemplate.jsp:

<%@ taglib uri='/WEB-INF/struts-template.tld' prefix='template' %>
<html>
        <head>
                <title><template:get name='title'/></title>
        </head>
        
        <body>
                <table>  
                <tr valign='top'>
                        <table>            
                                <tr><td color=lightblue><template:get
name='header'/></td></tr>            
                                <tr><td><template:get
name='content'/></td></tr>
                                <tr><td><template:get
name='footer'/></td></tr>          
                        </table>      
                        </td>   
                </tr>
                </table>
        </body>
</html>

this is how u use it:

<%@ taglib uri='/WEB-INF/struts-template.tld' prefix='template' %>
<template:insert template='/xtest/jsp/xtestTemplate.jsp'>  
<template:put name='title' content='Templates' direct='true'/>  
<template:put name='header' content='/xtest/jsp/xtestHeader.jsp' />  
<template:put name='content' content='/xtest/jsp/xForm.jsp'/>  
<template:put name='footer' content='/xtest/jsp/xtestFooter.jsp' />
</template:insert>

make your JSP's and just put them wherever u want them.


-----Original Message-----
From: Henry Lu [mailto:[EMAIL PROTECTED]] 
Sent: Monday, February 18, 2002 3:14 PM
To: Struts Users Mailing List
Subject: RE: struts template

I got the following error:
javax.servlet.ServletException: Exception forwarding for name welcome:
org.apache.jasper.JasperException: XML parsing error on file
/WEB-INF/jsp/reg/mytemplate.jsp: (line 1, col 2): The markup in the
document preceding the root element must be well-formed.

the main jsp file:
<%@ page language="java" %>
<%@ taglib uri="/tags/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/tags/struts-html.tld" prefix="html" %>
<%@ taglib uri="/tags/struts-logic.tld" prefix="logic" %>
<html:html>
<head>
<html:base/>
</head>
<body bgcolor=#FFFFFF link="#000066" vlink="#660066" alink="#33CCCC">
<%@ taglib uri="mytemplate.jsp" prefix="g_template" %>
<g_template:get name="header" />

<h1>Hello, STRUTS!</h1>
</body>
</html:html>
-------------------------------------------
the mytemplate.jsp file:

<%@ taglib uri="/template" prefix="template" %>
<template:insert>
 <template:put name="header" content="header.jsp" />
</template:insert>
-------------------------------------------
header.jsp file
<hr>
<center>
<h1>University of Michigan</h1>
</center>
<hr>


---------------------------------------------------------------------------
Henry Lu
MCIT                                            phone: (734) 936-2063
University of Michigan Medical Center           fax:   (734) 763-4372

On Mon, 18 Feb 2002, Arik  Levin ( Tikal ) wrote:

> What is the problem shoot.
>
> -----Original Message-----
> From: Henry Lu [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 18, 2002 2:39 PM
> To: Struts Users Mailing List
> Subject: struts template
>
> Is there any examples with struts template tag? I have had difficulties to
> use it.
>
> Thanks,
>
>
>
---------------------------------------------------------------------------
> Henry Lu
> MCIT                                            phone: (734) 936-2063
> University of Michigan Medical Center           fax:   (734) 763-4372
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

Reply via email to