You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mikkel Bruun <mi...@valtech.dk> on 2001/05/15 15:10:34 UTC

The template mechanism

I have studied the documentation for the template mechanism, but it doesn't
seem to fit my needs...

Here's the scenario (I have previously implemented this in my struts like
framework):

I want all requests to forward to index.jsp

index.jsp then uses the template tag to insert the different sections
TOP
LEFT
"contents"
RIGHT
BOTTOM

"contents" is then a pathname to the actual .jsp page that we want to show,
which could be placed in the action mapping...

Is this possible in struts??? If not, it ought to be, as I think this is a
much nicer way if doing template than to have the actual contents include
template sections...

thanks

Mikkel Bruun

Re: The template mechanism

Posted by Cedric Dumoulin <ce...@lifl.fr>.
  Check the Components / Extended Templates proposal. There are solutions for
you.


   * Example - first solution :
        o Use Components "dynamic templates" : you define your template
          attributes inside your action, and insert the template definition in
          your jsp page.
        o Check comps-tutorial/dynFramesetPage.jsp and DynTemplateAction.java
   * Example - second solution :
        o Define "template definitions" (or screens) in a centralized file.
          Then, in your struts-config.xml file, you can set forward tag to
          forward to a template definition. Furthermore, your definition can
          inherit from a parent definition, avoiding rewriting all definition
          attributes.
        o Check  struts-config.xml for action 'forwardExampleAction',
          templateDefinitions.xml  for definitions 'mainLayout' and
          'forward.example.success.page'

    Cedric

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




Mikkel Bruun wrote:

> I have studied the documentation for the template mechanism, but it doesn't
> seem to fit my needs...
>
> Here's the scenario (I have previously implemented this in my struts like
> framework):
>
> I want all requests to forward to index.jsp
>
> index.jsp then uses the template tag to insert the different sections
> TOP
> LEFT
> "contents"
> RIGHT
> BOTTOM
>
> "contents" is then a pathname to the actual .jsp page that we want to show,
> which could be placed in the action mapping...
>
> Is this possible in struts??? If not, it ought to be, as I think this is a
> much nicer way if doing template than to have the actual contents include
> template sections...
>
> thanks
>
> Mikkel Bruun