You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Cedric Dumoulin <ce...@lifl.fr> on 2001/04/03 17:55:06 UTC

Re: Help PLEASE!!!! How do you create struts template file usingframe instead of table

  Hi Anh,

  Does your application is at your server root directory, or in a site directory
(like struts-example) ?
  In this later case, you need to prefix getted url (<template:get
name='header'/>) with your site url (<%=request.getContextPath()%>) like in the
following  :
<frame name="headerFrame" src="<%=request.getContextPath()%><template:get
name='header'/>"
marginwidth="5" marginheight="5" scrolling="no" border="0"  frameborder="no"
noresize>
  Do the same for each getted url.

  If this doesn't work, could you compare the url shown by your browser, and the
url generated in the html file (browser->view->source ...) ?
  Does the file exist for the generated url ?

     Cedric


"Hoang, Anh" wrote:

> Hi Mr. DuMoulin,
>
> Thank you for answering my question in both component and template. Template
> and Component are similar so I thought I try both.
> Any way, I had tried using component and template the way you show me, but I
> only see the frame display but nothing else but the following error:
>  "Action canceled Internet Explorer was unable to link to the Web page you
> requested. The page might be temporarily unavailable."
> The reason I want to use Frame is that I find a javascript menu that works
> for both IE and Netscape which I want to use for our web application, the
> problem is that it works only for Frame.
> Attached is the code that I have in my template and my setup page. If you
> have time please take a look and tell me what did I do wrong. Thank you very
> much for your help. I do really appreciated that.
> anh
>
> below is the code in my template.jsp
> ******************************************
> <%@ 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="JDPLogo.gif" marginwidth="5"
> marginheight="5" scrolling="no" border="0" frameborder="no" noresize>
>     <frame name="headerFrame" src="<template:get name='header'/>"
> marginwidth="5" marginheight="5" scrolling="no" border="0"  frameborder="no"
> noresize>
>     <frame name="menuFrame" src="<template:get name='menu'/>"
> 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="<template:get name='menu'/>"
> marginwidth="5" marginheight="5" scrolling="no" border="0" frameborder="no"
> noresize>
>     </frameset>
> </frameset>
> </html>
> *************************************
> And here is the code from my insert tag:
>
> <%@ taglib uri="/struts-template" prefix="template" %>
> <%@ taglib uri="/app" prefix="app" %>
>
> <app:checkLogon />
>
> <template:insert template="/jsp/mainFrameTemplate.jsp" flush="true">
>   <template:put name="title"  content="JDP Home Site" direct="true"/>
>   <template:put name="header" content="/jsp/header.jsp" direct="true"/>
>   <template:put name="menu" content="/jsp/expandable.html" direct="true">
>   <template:put name="footer" content="/jsp/footer.jsp" direct="true"/>
> </template:insert>
>
> *******************************************************************
> > -----Original Message-----
> > From: Cedric Dumoulin [SMTP:cedric.dumoulin@lifl.fr]
> > Sent: Friday, March 30, 2001 3:10 AM
> > To:   struts-user@jakarta.apache.org
> > Subject:      Re: Help PLEASE!!!!  How do you create struts template file
> > using frame  instead of table
> >
> >
> >   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.