Hi, Henry !

I think the problem is a confusion on which file is the template.

In the sample, the template should be 'main.jsp', and not 'header.jsp'; the
latter file is just an element that should be inserted inside the template.

Hence, I would change the names used for almost all of the files. But, for
the sake of simplicity, I will keep them in the suggestions given below.

In 'main.jsp', which is the template, I would use:

<%@ taglib uri="/tags/struts-template.tld" prefix="g_template" %>

instead of:

<%@ taglib uri="mytemplate.jsp" prefix="g_template" %>

and would place this directive at the top of the page, among the other ones.

Then, I would create the following JSP page, which is an 'instance' of the
template, and will be the page exposed to the users of the application:

<%@ taglib uri="/tags/struts-template.tld" prefix="template"%>
<template:insert template="main.jsp">
  <template:put name="header" content="header.jsp"/>
</template:insert>

Hope this helps

Cheers

Luis

----- Original Message -----
From: "Henry Lu" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Monday, February 18, 2002 10:13 AM
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]>
>
>


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

Reply via email to