Hello Anh,

  In the template page, you have to write something like :
-------------------
<frameset rows="73, *, 73">
  <frame src="<%=request.getContextPath()%><template:get name="header" />"
name="header" >
  <frame src="<%=request.getContextPath()%><template:get name="body" />"
name="body" >
  <frame src="<%=request.getContextPath()%><template:get name="footer" />"
name="footer" >
</frameset>
------------------
The scriplet <%=request.getContextPath()%> is not mandatory, but it allows to
put relative URL rather than absolute URL in the insert tag. Thus, your page are
portable on different sites.

  Your insert tag looks like :
------------------
<template:insert template="/basic/myFramesetLayout.jsp" >
  <template:put name="title"      content="My first page"
direct="true" />
  <template:put name="header" content="/common/header.jsp" direct="true"/>
  <template:put name="footer"  content="/common/footer.jsp"   direct="true"/>
  <template:put name="body"   content="/basic/helloBody.jsp" direct="true"/>
</template:insert>
-----------------
  Don't forget direct="true" ! This instruct to output the string as is, rather
than trying to include a jsp page.

  Cedric

"Hoang, Anh" wrote:

> Hello all,
>
> In the template tag example, the template file used the table and table row
> to indicate where in the layout to insert the content. Is there a way to
> build the template file using frame instead of table? How do you specify the
> src so that it will take <template:get name="anything"/> to be the file to
> be displayed in the frame? In other world, how do you change the following
> code:
>
> <%@ taglib uri="/struts-template.tld" prefix="template" %>
>
> <%-- Layout component
>   parameters : title, header, menu, body, footer
> --%>
>   <HEAD>
>     <title><template:get name="title"/></title>
>   </HEAD>
>
> <body>
> <table>
>   <tr>
>     <td valign="top"><template:get name="header"/></td>
>   </tr>
>   <tr>
>     <td width="25%" valign="top"><template:get name='menu'/></td>
>     <td colspan="100%">
>     <table> <template:get name="main" /> </table>
>    </td>
>   </tr>
>   <tr>
>     <td colspan="2">
>       <template:get name="footer" />
>     </td>
> </tr>
> </table>
>
> To this code:
>
> <%@ taglib uri="/struts-template.tld" prefix="template" %>
>
> <%-- Frameset Layout component
>   parameters : title, header, menu, body, footer
> --%>
>
> <html>
> <head>
>     <title><template:get name="title"/></title>
> </head>
> <frameset  rows="16%,*" cols="19%,*">
>     <frame name="logoFrame" src="Logo.gif" marginwidth="5" marginheight="5"
> scrolling="no" border="0" frameborder="no" noresize>
>     <frame name="headerFrame" src="" marginwidth="5" marginheight="5"
> scrolling="no" border="0"  frameborder="no" noresize>
>     <frame name="menuFrame" src="" marginwidth="0" marginheight="5"
> scrolling="auto" border="0"  frameborder="no" noresize>
>     <frameset  rows="84%,*">
>         <frame name="mainFrame" src="" marginwidth="5" marginheight="5"
> scrolling="auto" border="0" frameborder="no" noresize>
>         <frame name="footerFrame" src="" marginwidth="5" marginheight="5"
> scrolling="no" border="0" frameborder="no" noresize>
>     </frameset>
> </frameset>
>
> </html>
>
> I tried to put src="<template:get name='header'/>" but it didn't work.
>
> Is it possible of using frame with template or table and row are the only
> choices? Thank you very much for your help.

Reply via email to