struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sean Gay" <sean....@modus.com.au>
Subject RE: template
Date Tue, 03 Sep 2002 02:28:15 GMT
Kevin,

Firstly let me apologise for giving you slightly incorrect information about
your problem initially. Never fear though I have a working solution for you.

Using the direct=true is correct in this case as you are putting the output
into a frameset (I missed this initially) and not including the file into
the template. This being the case you need to treat it like a string and
have the full path to the file placed in here. I think where things are
going wrong is where you may have a context path which is making your app
look in the wrong spot for the file when it tries to display within the
frameset. If you include this context path where you are outputting
"welcome.html" you should be right.

I have done this in the attached zip. If you just unzip and place in the
directory that you have your app running you should be able to see what I am
explaining.

Again sorry for the initial goose chase that I sent you on.

Regards,
Sean

-----Original Message-----
From: Keven [mailto:hinbsls@yahoo.ca]
Sent: Tuesday, September 03, 2002 10:06 AM
To: Struts Users Mailing List
Subject: Re: template


Sean:

Thank you for your reply.
I removed direct='true'. So the index.jsp is look like:

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

<template:insert template='/template.jsp'>

  <template:put name='title' content='Templates' direct='true'/>
  <template:put name='header' content='/welcome.html' />
  <template:put name='content' content='/welcome.html'  />
</template:insert>

welcome.jsp is:

<html>
<head>
<title> New Document </title>
</head>

<body>
 Hello
</body>
</html>

When I run index.jsp, the error changed to:

Apache Tomcat/4.0.4 - HTTP Status 404 - /<html> <head><title> New Document
</title></head><body>Hello</body></html>

----------------------------------------------------------------------------
----

type Status report

message /<html> <head><title> New Document
</title></head><body>Hello</body></html>

description The requested resource (/<html> <head><title> New Document
</title></head><body>Hello</body></html>) is not available.

Could you please give me a clue what is wrong this time?

Thank you very much!

Keven




----- Original Message -----
From: "Sean Gay" <sean.gay@modus.com.au>
To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
Cc: <hinbsls@yahoo.ca>
Sent: Monday, September 02, 2002 7:21 PM
Subject: RE: template


> Hey Kevin,
>
> I think I know what is going on here.
>
> When you are doing "<template:put name='header' content='/welcome.html'
> direct='true'/>" you are using direct=true which directly outputs the
string
> "/welcome.html" as the file to be used for the header. This would mean
that
> any contextPath that you have for your server is not being applied and as
> such no file can be found as it is looking for it in the root of your web
> server.
>
> I think that what you should be using is something like the following
which
> will include the file rather than just outputting the string.
"<template:put
> name='header' content='/welcome.html'/>"
>
> The same would apply for the content.
>
> Hopefully this solves your problem. I usually only create separate files
if
> they are going to be used over multiple pages, such as navigation, page
> headers etc. You could also do something like this to save having
> superfluous files lying around.
>
> <template:put name='content'>
>     INSERT YOUR PAGE CONTENT IN HERE
> </template:put>
>
> Regards,
> Sean
>
> -----Original Message-----
> From: Keven [mailto:hinbsls@yahoo.ca]
> Sent: Tuesday, September 03, 2002 8:48 AM
> To: Struts Users Mailing List
> Subject: template
>
>
> Hi, All:
>
> I have a template jsp called template.jsp. The content of template.jsp is:
>
> <%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
>
> <html>
> <head>
> <title><template:get name='title'/></title>
> </head>
>
> <frameset  rows="20%,*">
>
>   <FRAME src="<template:get name='header' flush='true'/>">
>   <FRAME src="<template:get name='content' flush='true'/>">
>
> </frameset>
> </html>
>
> I have another jsp file called  index.jsp which uses the template.jsp. The
> content of index.jsp is:
>
> <%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
>
> <template:insert template='/template.jsp'>
>
>   <template:put name='title' content='Templates' direct='true'/>
>   <template:put name='header' content='/welcome.html' direct='true'/>
>   <template:put name='content' content='/tour.html' direct='true' />
> </template:insert>
>
> Whenever I tried to run it in tomcat, I got
> "Apache Tomcat/4.0.4 - HTTP Status 404 - /welcome.html
>
> type Status report
>
> message /Welcome.html
>
> description The requested resource (/Welcome.html) is not available.
>
> "
> Apache Tomcat/4.0.4 - HTTP Status 404 - /tour.html"
>
> type Status report
>
> message /tour.html
>
> description The requested resource (/tour.html) is not available.
>
>
>
> I got the above messages in different frame.I don't know what cause the
> problem. Some one knows how to fix it?
>
> Thank you very much
>
> Keven
>
>
>
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>

Mime
View raw message