Chris,

Yes!
That worked.
Thank you very much for your help :)

-Michelle

--- In [EMAIL PROTECTED], "Bartley, Chris P" <[EMAIL PROTECTED]> wrote:
> Hey Michelle,
> 
> I think it might be because in classicLayout2.jsp, you have this:
> 
>    <tiles:insert attribute="html.head">
>       <tiles:put name="window.title.key">
>          <tiles:getAsString name="window.title.key" ignore="true"/>
>       </tiles:put>
>       <tiles:put name="javascript_includes.forwards"
> beanName="javascriptIncludesForwards" />
>    </tiles:insert>
> 
> ...where the <tiles:put> that puts the list of includes references 
a bean
> named "javascriptIncludesForwards", but there is no such bean.  
What i
> forgot to tell you in my original post is that my main layout page 
also has
> this line right before the <tiles:insert>:
> 
>    <tiles:useAttribute id="javascriptIncludesForwards"
> name="javascript_includes.forwards" classname="java.util.List"
> ignore="true"/>
> 
> Sorry about that.  Add that to your classicLayout2.jsp and you 
should be
> good to go.
> 
> chris
> 
> > -----Original Message-----
> > From: mpopovits.rm [mailto:mpopovits@h...]
> > Sent: Tuesday, July 30, 2002 9:46 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: tiles & javascript
> > 
> > 
> > Hi Chris,
> > 
> > Many thanks for the information and your example code!!
> > 
> > I'm working through your example and I am trying to apply it to 
my 
> > situation.
> > The problem I'm having is that in the Head layout jsp it's not 
> > recognizing that the javascriptIncludesForwards is PRESENT.
> > 
> > Is there something I missed in my implementation?
> > 
> > Thanks,
> > Michelle
> > 
> > ************************
> > --- HeadLayout.jsp -- (it shows the 'before Present Tag' comment 
but 
> > none of the others inside)
> > ************************
> > 
> > <%@ taglib uri="tiles.tld" prefix="tiles" %>
> > <%@ taglib uri="struts-html.tld" prefix="strutshtml" %>
> > <%@ taglib uri="struts-bean.tld" prefix="strutsbean" %>
> > <%@ taglib uri="struts-logic.tld" prefix="strutslogic" %>
> > <%--
> > <tiles:useAttribute id="windowTitleKey" 
> >                     name="window.title.key"
> >                     classname="java.lang.String" />
> > --%>
> > <tiles:useAttribute id="javascriptIncludesForwards"
> >                     name="javascript_includes.forwards" 
> >                     classname="java.util.List"
> >                     ignore="true"/>
> > 
> > 
> > <!-- Start of HeadLayout.jsp -->
> > <head>
> >     <title>
> > <%--      <strutsbean:message key="<%= windowTitleKey %>"/> --%>
> > Hello World
> >     </title>
> >     
> >     <meta http-equiv="Content-Type" content="text/html; 
charset=utf-
> > 8" />
> >     <link rel="StyleSheet" href="<%= request.getContextPath() %
> > ><strutsbean:message key="global.styleSheet"/>" type="text/css" 
> > media="screen">
> >     <script src="<%= request.getContextPath() %
><strutsbean:message 
> > key="global.javaScript.common"/>"></script>
> > 
> > <%--
> >     <link rel="stylesheet" type="text/css" 
> > href="<strutshtml:rewrite forward="forward.stylesheet"/>">
> > --%>
> > 
> > <!-- before Present tag -->
> > 
> >     <strutslogic:present name="javascriptIncludesForwards">
> > <!-- before iterate tag -->
> >       <strutslogic:iterate id="currentForward" 
> >                            name="javascriptIncludesForwards"
> >                            type="java.lang.String">
> >     
> > <!-- inside iterate tag -->
> >          <script src="<strutshtml:rewrite forward="<%= 
> > currentForward %>"/>"
> >                  language="JavaScript" 
> >                  type="text/javascript">
> >          </script>
> >          
> >       </strutslogic:iterate>
> >     </strutslogic:present>
> > 
> > </head>
> > <!-- End of HeadLayout.jsp -->
> > 
> > 
> > **********************
> > --- tiles-defs.xml ---
> > **********************
> > 
> > 
> > 
> >   <definition name="template.main" 
> > path="/jsp/layouts/classicLayout2.jsp">
> >       <put name="html.head" value="template.main.html.head"/>
> >       <put name="window.title.key" value="site.title"/>
> >       <put name="page.header" value="/jsp/common/header.jsp"/>
> >       <put name="page.body" value="template.main.body"/>
> >       <put name="page.footer" value="/jsp/common/footer.jsp"/>
> >       <putList name="javascript_includes.forwards"/>
> >    </definition>
> > 
> > 
> >   <definition name="template.main.html.head" 
> > path="/jsp/layouts/HeadLayout.jsp">
> >       <put name="window.title.key" value="site.title"/>
> >       <putList name="javascript_includes.forwards"/>
> >   </definition>
> > 
> > 
> >   <definition name="template.roleList" extends="template.main">
> >       <put name="title"  value="Tiles Blank Site Index" />
> >       <put name="page.body" value="/jsp/role/RoleListBody.jsp"/>
> >       <putList name="javascript_includes.forwards">
> >          <add>forward.roleList.js</add>
> >       </putList>
> >   </definition>
> > 
> > 
> > **************************
> > --- classicLayout2.jsp ---
> > **************************
> > 
> > <%@ taglib uri="tiles.tld" prefix="tiles" %>
> > <%@ taglib uri="struts-html.tld" prefix="strutshtml" %>
> > 
> > <%-- Layout Tiles 
> >   This layout create a html page with <header> and <body> tags. 
It 
> > render
> >    a header, left menu, body and footer tile.
> >   @param title String use in page title
> >   @param header Header tile (jsp url or definition name)
> >   @param body Body
> >   @param footer Footer
> > --%>
> > 
> > <!doctype HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> > <strutshtml:html locale="true">
> > 
> > 
> > <tiles:insert attribute="html.head">
> >    <tiles:put name="window.title.key">
> >       <tiles:getAsString name="window.title.key" ignore="true"/>
> >    </tiles:put>
> >    <tiles:put name="javascript_includes.forwards" 
> > beanName="javascriptIncludesForwards" />
> > </tiles:insert>
> > 
> > 
> > <body bgcolor="#ffffff" text="#000000" link="#023264" 
alink="#023264" 
> > vlink="#023264">
> > <table border="0" width="100%" cellspacing="5">
> > <tr>
> >   <td colspan="2"><tiles:insert attribute="page.header" /></td>
> > </tr>
> > <tr>
> >   <td valign="top"  align="left">
> >     <tiles:insert attribute='page.body' />
> >   </td>
> > </tr>
> > <tr>
> >   <td colspan="2">
> >     <tiles:insert attribute="page.footer" />
> >   </td>
> > </tr>
> > </table>
> > </body>
> > </strutshtml:html>
> > 
> > 
> > **************************
> > --- RoleList.jsp ---
> > **************************
> > 
> > <%@ page language="java" %>
> > <%@ taglib uri="tiles.tld" prefix="tiles" %>
> > 
> >   <%-- Insert a definition described in tiles configuration file 
> >     Change the definition name to insert another definition.
> >     It is possible to overload some definition attribute by adding
> >     some put tags with appropriate name.
> >   --%>
> > <tiles:insert definition="template.roleList" flush="true" />
> > 
> > 
> > **************************
> > --- Struts-config.xml ---
> > **************************
> > 
> > 
> > 
> >    <global-forwards
> >       type="org.apache.struts.action.ActionForward" >
> >     
> >      <!-- Global forwards for JavaScript (JS) files -->
> >      <forward name="forward.roleList.js" path="/js/roleList.js" />
> > 
> > 
> >   </global-forwards>
> > 
> > 
> > 
> > 
> > 
> > --- In [EMAIL PROTECTED], "Bartley, Chris P" <[EMAIL PROTECTED]> wrote:
> > > I'm not promising that this is the best solution, but here's 
what I 
> > did...
> > > 
> > > I first set up my main layout template and header templates to 
take 
> > an
> > > optional list of forwards (where each forward is defined as a 
> > global forward
> > > in struts-config.xml and points to a .js file), like this:
> > > 
> > >    <definition name="template.main"
> > > path="/jsp/html/common/main/template.jsp">
> > >       <put name="html.head"         
> > value="template.main.html.head"/>
> > >       <put name="window.title.key"  
value="key.HomeWindowTitle"/>
> > >       <putList name="javascript_includes.forwards"/>
> > >       <put name="page.header"       
value="template.main.header"/>
> > >       <put name="page.body"         value="template.main.body"/>
> > >       <put name="page.footer"       
value="template.main.footer"/>
> > >    </definition>
> > > 
> > >    <definition name="template.main.html.head"
> > > path="/jsp/html/common/main/htmlHead.jsp">
> > >       <put name="window.title.key" value="key.HomeWindowTitle"/>
> > >       <putList name="javascript_includes.forwards"/>
> > >    </definition>
> > > 
> > > In the JSP for the main layout template, the list of forwards 
is 
> > just passed
> > > on to the header template like this:
> > > 
> > >    <tiles:insert attribute="html.head">
> > >       <tiles:put name="window.title.key"><tiles:getAsString
> > > name="window.title.key" ignore="true"/></tiles:put>
> > >       <tiles:put name="javascript_includes.forwards"
> > > beanName="javascriptIncludesForwards" />
> > >    </tiles:insert>
> > > 
> > > The header template looks like this:
> > > 
> > >    <%@ taglib uri="tiles" prefix="tiles" %>
> > >    <%@ taglib uri="struts-html" prefix="html" %>
> > >    <%@ taglib uri="struts-bean" prefix="bean" %>
> > >    <%@ taglib uri="struts-logic" prefix="logic" %>
> > > 
> > >    <tiles:useAttribute id="windowTitleKey" 
name="window.title.key"
> > > classname="java.lang.String" />
> > >    <tiles:useAttribute id="javascriptIncludesForwards"
> > > name="javascript_includes.forwards" classname="java.util.List"
> > > ignore="true"/>
> > > 
> > >    <head>
> > >    <title><bean:message key="<%= windowTitleKey %>"/></title>
> > >    <link rel="stylesheet" type="text/css" href="<html:rewrite
> > > forward="forward.stylesheet"/>">
> > >    <logic:present name="javascriptIncludesForwards">
> > >       <logic:iterate id="currentForward" 
> > name="javascriptIncludesForwards"
> > > type="java.lang.String">
> > >          <script src="<html:rewrite forward="<%= currentForward 
%
> > >"/>"
> > > language="JavaScript" type="text/javascript"></script>
> > >       </logic:iterate>
> > >    </logic:present>
> > >    </head>
> > > 
> > > I then leave it up to each individual template definition to 
> > determine which
> > > .js include files should be included for that page.  For 
example:
> > > 
> > >     <definition name="template.foo.view" 
extends="template.main">
> > >         <put name="page.body" value="template.foo.view.body"/>
> > >         <putList name="javascript_includes.forwards">
> > >           <add>forward.windows.js</add>
> > >           <add>forward.widgets.js</add>
> > >         </putList>
> > >     </definition>
> > >     <definition name="template.foo.view.body" 
> > extends="template.home.body">
> > >         <!-- ... -->
> > >     </definition>
> > > 
> > > The "forward.windows.js" and "forward.widgets.js" would then be 
> > defined in
> > > struts-config.xml as global forwards, something like this:
> > > 
> > >      <forward name="forward.widgets.js" 
> > path="/javascript/widgets.js" />
> > >      <forward name="forward.windows.js" 
> > path="/javascript/windows.js" />
> > > 
> > > If no .js include files are required for a page, then the 
template
> > > definition for that page simply doesn't include a <putList> 
block 
> > at all.
> > > 
> > > Works great for what I need.  Hope this helps.
> > > 
> > > chris
> > > 
> > > > -----Original Message-----
> > > > From: Michelle Popovits [mailto:mpopovits@h...]
> > > > Sent: Monday, July 29, 2002 4:02 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: tiles & javascript
> > > > 
> > > > 
> > > > Hi,
> > > > 
> > > > I'm new to tiles and am wondering what the best way is to 
> > integrate 
> > > > javascript, as follows:
> > > > 
> > > > Before Tiles:
> > > > I had a main jsp (with some includes for header/footer) and 
> > > > some embedded 
> > > > javascript and js file references.
> > > > 
> > > > After Tiles:
> > > > I have tiles setup for header/footer/body.  The layout that I 
> > > > am using is 
> > > > (and should be fairly generic) as is the header/footer.  Now, 
> > > > the body tile 
> > > > makes use of some javascript functions both embedded and as 
> > > > js references.
> > > > 
> > > > Where do I put this javascript code? I am assuming that it 
> > > > should not go in 
> > > > the layout because that is being used by multiple pages.  It 
> > > > doesn't really 
> > > > belong in the header/footer either.  And shouldn't the body 
tile 
> > just 
> > > > contain the body portion (not <head> information).
> > > > 
> > > > Any suggestions as the what the best approach is for this 
> > > > would be greatly 
> > > > appreciated.
> > > > 
> > > > Many thanks,
> > > > Michelle
> > > > 
> > > > 
> > > > 
> > > > 
_________________________________________________________________
> > > > Chat with friends online, try MSN Messenger: 
> > http://messenger.msn.com
> > > > 
> > > > 
> > > > --
> > > > To unsubscribe, e-mail:   
> > > <mailto:struts-user-unsubscribe@j...>
> > > For additional commands, e-mail:
> > > <mailto:struts-user-help@j...>
> > > 
> > > --
> > > To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@j...>
> > > For additional commands, e-mail: <mailto:struts-user-help@j...>
> > 
> > 
> > --
> > To unsubscribe, e-mail:   
> <mailto:struts-user-unsubscribe@j...>
> For additional commands, e-mail:
> <mailto:struts-user-help@j...>
> 
> --
> To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@j...>
> For additional commands, e-mail: <mailto:struts-user-help@j...>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to