struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Assenza, Chris" <casse...@Accessdc.com>
Subject RE: Template -struts-template and generated HTML / templating usi ng PUSH model
Date Wed, 28 Mar 2001 21:11:46 GMT
Harcq,

I just ran into this problem myself with WebSphere.  The GetTag.java - the
source behind the template:get tag that actually does the include calls
pageContext and includes whatever content should go in.  By default, the
servlet engine should flush the buffer (that's what allows an include to go
somewhere within your page). However, apparently some servers don't do that
by default (WS 3.5.3 doesn't seem to).  The solution is an easy one, but
you'll need to recompile Struts. 

Under struts/src/share/org/apache/struts/taglib/template you will see a file
called GetTag.java.  Open that file.  In the doStartTag() method you'll find
the following code: 

	pageContext.include(content.toString());

To fix your problem (hopefully, worked for me) add the following line above
it:

	pageContext.getOut().flush();

So your end result will look like:

pageContext.getOut().flush();
pageContext.include(content.toString());

By hardcoding the flush your problems should be solved. Recompiling struts
is documented on the Struts installation web page. :)

HTH, 

Chris Assenza


-----Original Message-----
From: Vincent Harcq [mailto:vincent_harcq@yahoo.com]
Sent: Wednesday, March 28, 2001 2:59 AM
To: User Struts
Subject: Template -struts-template and generated HTML / templating using
PUSH model


Hi,

1. I am beginning to look at Templating mechanism and so use the example
struts-template using version pre-beta-2 (23/03/01).
The result is a strange for me.  Can somebody explain me this.
On the first page, when I look at the generated code (look at the end of
message), I got something where the side-bar.jsp and header.jsp is included
BEFORE the <html> tag; while from what I see in chapterTemplate.jsp, the
<html> should appear first.
Is there a problem somewhere ?  Does somebody is aware of that ?  Is it my
browser ?

2. I was also thinking about another mean of doing templating.  The fact
that I have two create each 2 files (introduction.jsp and introduction.html)
is not really needed if you consider you have a little number of different
templates to work with.
Say you have only two templates (side-bar header content footer) (left-bar
header content right-bar footer), it is too much for me to create each time
the page that will use template:put.
I have done that before I used Struts in a "request processor" by setting
the value of a "content" field, forwarding to one of two pages template1.jsp
and template2.jsp that uses jsp include tags.
My plan was to do that in the findForward() method of ActionForwards and
forward all the time to one of the 2 template pages that I have and setting
the "content" value before.
To speak "philosophically", but wishing to not re-open this debate, the PUSH
method is for me more convenient that the "PULL" one for Page Templating
Mechanism.  But I do not want to "mix" Velocity and Struts """"only""" to
solve this templating problem.

Any ideas ?


HTML generated:
---------------

<font size='5'><a name="top">Topics</a></font><p>
  <table width='145'>
    <tr><td><a href='introduction.jsp'>
        Introduction </a></td></tr>

    <tr><td><a href='using.jsp'>
        Using Templates </a></td></tr>

    <tr><td><a href='optional.jsp'>
        Optional Content </a></td></tr>
    <tr><td><a href='more.jsp'>
        ... and more ...</a></td></tr>
  </table></p>

<table>
   <tr>
      <td><img src='graphics/java.gif'/></td>
      <td><img src='graphics/templates.gif'/></td>
   </tr>
</table><hr>
<html>
 . . .


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Mime
View raw message