You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Keven <hi...@yahoo.ca> on 2002/09/03 00:48:09 UTC

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





Re: template

Posted by Cedric Dumoulin <ce...@apache.org>.
Hi,

See intermixed.

Cedric

David Geary wrote:

>Hi Keven,
>
>Struts templates do not work with HTML frames; I believe that's the
>cause of your problem. (If anyone has gotten them to work with frames,
>please holler). When I originally developed templates, I tried to get
>them to work with frames, but it was very difficult. If I remember
>correctly it's because each frame creates its own request, which wreaks
>havoc with templates.
>
>That said, you really shouldn't need to resort to frames, because
>templates gives you pretty much the same functionality, except for being
>able to resize regions.
>
Personally I avoid using frameset because it results in several requests.

>
>I don't know if Tiles (which is an extension of templates) works with
>frames; my guess is that they don't, but Cedric should be able to answer
>that. Cedric, are you listening?
>
Tiles, and I think Templates also (not tested), work with frameset. But
you need to a well understanding of how frameset and Tiles/Templates work.
The frameset declaration look like the following:
<frameset rows="3">
<frame src="<template:get name="header" />" name="header" id="header"
scrolling="Auto">
<frame src="<template:get name="body" />" name="body" id="header"
scrolling="Auto">
<frame src="<template:get name="footer" />" name="footer" id="header"
scrolling="Auto">
</frameset>

And your insert tag:
<template:insert template="/tutorial/basic/myFramesetLayout.jsp" >
<template:put name="title" content="My first frameset page" direct="true" />
<template:put name="header" content="/tutorial/common/header.jsp"
direct="true"/>
<template:put name="footer" content="/tutorial/common/footer.jsp"
direct="true"/>
<ttemplate:put name="menu" content="/tutorial/basic/menu.jsp"
direct="true"/>
<template:put name="body" content="/tutorial/basic/helloBody.jsp"
direct="true"/>
</template:insert>

The key point is that the insertion of the body/header/footer is not
done with a <insert> tag on the server, but by the frameset from the
client browser. Thus, you have one request for each inserted tiles or
region.
There is a simple example of using frameset and tiles in
tiles-documentation.war (under tutorial/).

>
>btw, you're probably better off using Tiles or a later version of
>templates. Both implementations offer similar capabilities; which you
>prefer is largely a matter of taste. You can read about the later
>version of templates and download the source code at:
>
>http://www.javaworld.com/javaworld/jw-12-2001/jw-1228-jsptemplate_p.html.
>
>
>david
>
>Keven wrote:
>
>  
>
>>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:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>  
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: template

Posted by David Geary <sa...@earthlink.net>.
Hi Keven,

Struts templates do not work with HTML frames; I believe that's the
cause of your problem. (If anyone has gotten them to work with frames,
please holler). When I originally developed templates, I tried to get
them to work with frames, but it was very difficult. If I remember
correctly it's because each frame creates its own request, which wreaks
havoc with templates.

That said, you really shouldn't need to resort to frames, because
templates gives you pretty much the same functionality, except for being
able to resize regions.

I don't know if Tiles (which is an extension of templates) works with
frames; my guess is that they don't, but Cedric should be able to answer
that. Cedric, are you listening?

btw, you're probably better off using Tiles or a later version of
templates. Both implementations offer similar capabilities; which you
prefer is largely a matter of taste. You can read about the later
version of templates and download the source code at:

http://www.javaworld.com/javaworld/jw-12-2001/jw-1228-jsptemplate_p.html.


david

Keven wrote:

>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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


How to Create a Map object using tag or any other tag in Struts

Posted by Bunty <gp...@gpuri.com>.
Hi All,
How to Create a Map object using <bean:define> tag or any other tag in
Struts

This is my code snipplet,
<bean:define id="param1" name="ele" property="score"/>
<bean:define id="param2" name="ele" property="color" />
<%
java.util.HashMap params = new java.util.HashMap();
params.put("regno", param1);
params.put("regname", param2);
pageContext.setAttribute("paramsName", params);
%>

<html:link styleClass="link" page="/xAction.do?
action=x" name="paramsName"/>

I dont want to use the scriptlet. I want to put these two beans(param1 and
param2) in another bean collection using struts tags, so that I could use
the created bean name in my link. Could anyone pls help me in providing a
solution for this.
thanks

Bunty




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: template

Posted by Cedric Dumoulin <ce...@apache.org>.
Hello,

Check more carefully my previous reply. When I said "see intermixed", I
mean see lines intermixed in your reply. I am not referring to any tool.

Cedric

Keven wrote:

>Hi,Sean, David and Cedric:
>
>Thank you very much for your reply.
>Sean, I tried with the ziped files. It works fine. Thank you very much to make it so clear.
>
>Now, I am trying to use the same strategy to work with struts example(I modified the example for practise only). I have put all jsp files under Struts-example directory. I have index.jsp as following:
>
>template.jsp
>--------------
>
><%@ 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'/>">
>  <FRAME src="<template:get name='content'/>">
>
></frameset>
></html>
>-------------------------------------------------------------------------------------------------
>
>index.jsp:
>------------
>
><%@ 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' direct='true' >
>   <%= request.getContextPath() %>/Heading.jsp
>  </template:put>
>  <template:put name='content' direct='true'>
>   <%= request.getContextPath() %>/tour.html
>  </template:put>
></template:insert>
>----------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>Heading.jsp:
>---------------
>
><%@ page import="org.apache.struts.webapp.example.Constants" %>
><%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
><%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
>
><logic:present name="Constants.USER_KEY" scope = "session">
>
>  <a href="editRegistration.do?action=Edit" >MyAccount</a>
>
>  </logic:present>
>
>  <logic:notPresent name="Constants.USER_KEY" scope = "session">
>
>  <a href="editRegistration.do?action=Create" >join us</a>
>
></logic:notPresent>
>-----------------------------------------------------------------------------------------------------------------------------------------------------
>When I enter http://localhost:8080/Struts-example/index.jsp, I got the a page with join us on the header(top frame), and the content of tour.html on the bottom frame.
>
>When I click Join us link at the header, I want to have 1). URL changed to http://localhost:8080/Struts-example/editRegistration.do?action=Create, 2)  MyAccount on the header(top frame), and 3)  whatever content the above URL corresponding to on the bottom frame. In order to achieve this, I need to implement a jsp file which uses the template.jsp. The jsp file should be something like:
>
>myJsp.jsp:
>------------
>
><%@ 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' direct='true' >
>   <%= request.getContextPath() %>/Heading.jsp
>  </template:put>
>  <template:put name='content' direct='true'>
>   <%= request.getContextPath() %>/?????(What should I put here)
>  </template:put>
></template:insert>
>
>My question is: what should I put in the above commented area? I tried to put registration.jsp. It just doesn't work.
>
>David, you said that "Struts templates do not work with HTML frames". So we have no way to achieve this by using Struts template. Is my understanding right? From Cedric's answer, it seems there is a way in intermixed. I never used intermixed before. I will have a look at it.
>
>My boss likes to use frame with Struts framework. Is it really possible to do it? or we have to make decision to not use frame? Your opinion and help is appreciated.
>
>Once again, many thanks to Sean, David and Cedric.
>
>Regards.
>Keven
>
>
>
>
>
>----- Original Message ----- 
>From: "Sean Gay" <se...@modus.com.au>
>To: "Struts Users Mailing List" <st...@jakarta.apache.org>
>Cc: <hi...@yahoo.ca>
>Sent: Monday, September 02, 2002 10:28 PM
>Subject: RE: template
>
>
>  
>
>>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" <se...@modus.com.au>
>>To: "Struts Users Mailing List" <st...@jakarta.apache.org>
>>Cc: <hi...@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:
>>>      
>>>
>><ma...@jakarta.apache.org>
>>    
>>
>>>For additional commands, e-mail:
>>>      
>>>
>><ma...@jakarta.apache.org>
>>
>>    
>>
>
>
>--------------------------------------------------------------------------------
>
>
>  
>
>>--
>>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>>For additional commands, e-mail: <ma...@jakarta.apache.org>
>>    
>>
>
>  
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: template

Posted by Keven <hi...@yahoo.ca>.
Hi,Sean, David and Cedric:

Thank you very much for your reply.
Sean, I tried with the ziped files. It works fine. Thank you very much to make it so clear.

Now, I am trying to use the same strategy to work with struts example(I modified the example for practise only). I have put all jsp files under Struts-example directory. I have index.jsp as following:

template.jsp
--------------

<%@ 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'/>">
  <FRAME src="<template:get name='content'/>">

</frameset>
</html>
-------------------------------------------------------------------------------------------------

index.jsp:
------------

<%@ 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' direct='true' >
   <%= request.getContextPath() %>/Heading.jsp
  </template:put>
  <template:put name='content' direct='true'>
   <%= request.getContextPath() %>/tour.html
  </template:put>
</template:insert>
----------------------------------------------------------------------------------------------------------------------------------------------------------------

Heading.jsp:
---------------

<%@ page import="org.apache.struts.webapp.example.Constants" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<logic:present name="Constants.USER_KEY" scope = "session">

  <a href="editRegistration.do?action=Edit" >MyAccount</a>

  </logic:present>

  <logic:notPresent name="Constants.USER_KEY" scope = "session">

  <a href="editRegistration.do?action=Create" >join us</a>

</logic:notPresent>
-----------------------------------------------------------------------------------------------------------------------------------------------------
When I enter http://localhost:8080/Struts-example/index.jsp, I got the a page with join us on the header(top frame), and the content of tour.html on the bottom frame.

When I click Join us link at the header, I want to have 1). URL changed to http://localhost:8080/Struts-example/editRegistration.do?action=Create, 2)  MyAccount on the header(top frame), and 3)  whatever content the above URL corresponding to on the bottom frame. In order to achieve this, I need to implement a jsp file which uses the template.jsp. The jsp file should be something like:

myJsp.jsp:
------------

<%@ 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' direct='true' >
   <%= request.getContextPath() %>/Heading.jsp
  </template:put>
  <template:put name='content' direct='true'>
   <%= request.getContextPath() %>/?????(What should I put here)
  </template:put>
</template:insert>

My question is: what should I put in the above commented area? I tried to put registration.jsp. It just doesn't work.

David, you said that "Struts templates do not work with HTML frames". So we have no way to achieve this by using Struts template. Is my understanding right? From Cedric's answer, it seems there is a way in intermixed. I never used intermixed before. I will have a look at it.

My boss likes to use frame with Struts framework. Is it really possible to do it? or we have to make decision to not use frame? Your opinion and help is appreciated.

Once again, many thanks to Sean, David and Cedric.

Regards.
Keven





----- Original Message ----- 
From: "Sean Gay" <se...@modus.com.au>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Cc: <hi...@yahoo.ca>
Sent: Monday, September 02, 2002 10:28 PM
Subject: RE: template


> 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" <se...@modus.com.au>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Cc: <hi...@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:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


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


> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

RE: template

Posted by Sean Gay <se...@modus.com.au>.
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" <se...@modus.com.au>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Cc: <hi...@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:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>

Re: template

Posted by Keven <hi...@yahoo.ca>.
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" <se...@modus.com.au>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Cc: <hi...@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:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

RE: template

Posted by Sean Gay <se...@modus.com.au>.
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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>