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:   <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