Check the Components proposal, you will certainly find what you need.

  Cedric

Components sites :
  http://www.lifl.fr/~dumoulin/components/
  (mirror) : http://www.geocities.com/cedricdumoulin/components/


Pfingstl Gernot wrote:

>
>
> Is it possible to use a template in a template?
> I tried following:
>
> I have a file "/templates/main.jsp", which is the main layout for all
> pages
> (header, content and footer area and a page title):
>
> <%-- main.jsp --%>
> <%@ taglib uri='/WEB-INF/tlds/struts-template.tld' prefix='template'
> %>
> <html>
> <head>
>         <title><template:get name='title'/></title>
>         <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1">
>         <link rel="stylesheet"
> href="<%=request.getContextPath()%>/css/main.css" type="text/css">
> </head>
> <body>
> <table>
> <tr valign='top'>       <tr><td><template:get
> name='header'/></td></tr>
>                         <tr><td><template:get
> name='content'/></td></tr>
>                         <tr><td><template:get
> name='footer'/></td></tr>
> </table>
> </body>
> </html>
>
> Second step: I don't want to say all the time what header and footer
> to use, so I wrote other templates (which are based on
> /templates/main.jsp) which grouped some header and footer scenarios
> together. As an example I have /templates/layout1.jsp:
>
> <%-- layout1.jsp --%
> <%@ taglib uri='/WEB-INF/tlds/struts-template.tld' prefix='template'
> %>
> <template:insert template='/templates/main.jsp'>
>         <template:put name='header' content='/header.jsp'/>
>         <template:put name='footer' content='/footer.jsp'/>
>         <template:put name='title'><template:get
> name='title1'/></template:put>
> </template:insert>
>
> Third step: I have a JSP page, which uses layout1.jsp:
>
> <%-- page1.jsp --%>
> <%@ taglib uri='/WEB-INF/tlds/struts-template.tld' prefix='template'
> %>
> index1a
> <template:insert template='/templates/layout1.jsp'>
>         <template:put name='title1' content='Templates/Layout1'
> direct='true'/>
>                                                         <%-- I use
> direct for testing only>
>         <template:put name='content' content="/dok1.jsp" direct='true'
> />
>                                                         <%-- I use
> direct for testing only>
> </template:insert>
>
> If I call page1.jsp in the browser I get an exception (see below).
> If I change the line "<template:put name='title'><template:get
> name='title1'/></template:put>"
> in layout1.jsp to "<template:put name='title'>some static
> text</template:put>" everything goes right!
> Can I use nested templates?
> If yes, how can I use them?
>
> The exception text:
>
> 500 Internal Server Error
> /page1.jsp:
>
> javax.servlet.ServletException: Exception thrown processing JSP page.
> javax.servlet.jsp.JspException: Exception thrown processing JSP page.
>         java.lang.Throwable(java.lang.String)
>         java.lang.Exception(java.lang.String)
>         javax.servlet.jsp.JspException(java.lang.String)
>         int org.apache.struts.taglib.template.InsertTag.doEndTag()
>         void
> jrun__index2ejspa._jspService(javax.servlet.http.HttpServletRequest,
> javax.servlet.http.HttpServletResponse)
>
>         void
> allaire.jrun.jsp.HttpJSPServlet.service(javax.servlet.ServletRequest,
> javax.servlet.ServletResponse)
>         void
> allaire.jrun.servlet.JRunSE.service(javax.servlet.Servlet,
> javax.servlet.http.HttpServletRequest,
> javax.servlet.http.HttpServletResponse)
>
>         void
> allaire.jrun.servlet.JRunSE.runServlet(allaire.jrun.servlet.JRunChain,
> allaire.jrun.servlet.ForwardRequest,
> allaire.jrun.servlet.JRunResponse)
>
>         void
> allaire.jrun.servlet.JRunNamedDispatcher.forward(javax.servlet.ServletRequest,
> javax.servlet.ServletResponse)
>
>         void
> allaire.jrun.jsp.JSPServlet.service(javax.servlet.ServletRequest,
> javax.servlet.ServletResponse)
>         void
> allaire.jrun.servlet.JRunSE.service(javax.servlet.Servlet,
> javax.servlet.http.HttpServletRequest,
> javax.servlet.http.HttpServletResponse)
>
>         void
> allaire.jrun.servlet.JRunSE.runServlet(allaire.jrun.servlet.JRunChain,
> allaire.jrun.servlet.ForwardRequest,
> allaire.jrun.servlet.JRunResponse)
>
>         void
> allaire.jrun.servlet.JRunRequestDispatcher.forward(javax.servlet.ServletRequest,
> javax.servlet.ServletResponse)
>
>         void
> allaire.jrun.servlet.JRunSE.service(javax.servlet.http.HttpServletRequest,
> javax.servlet.http.HttpServletResponse)
>
>         void
> allaire.jrun.servlet.JvmContext.dispatch(javax.servlet.http.HttpServletRequest,
> javax.servlet.http.HttpServletResponse)
>
>         void allaire.jrun.http.WebEndpoint.run()
>         void allaire.jrun.ThreadPool.run(java.lang.Runnable)
>         void allaire.jrun.WorkerThread.run()
>
> Thank you,
> Gernot

Reply via email to