RE: Template -struts-template and generated HTML / templating using PUSH model
Many Thanks. It works OK now under Tomcat 3.2.1. Is there a problem in "flush" under Tomcat 3.2.1; in this case this patch would be appreciate for final Struts 1.0. Or is it my Tomcat configuration ? Vincent. -Message d'origine- De : Assenza, Chris [mailto:[EMAIL PROTECTED]] Envoyé : mercredi 28 mars 2001 23:12 À : '[EMAIL PROTECTED]' Objet : RE: Template -struts-template and generated HTML / templating using PUSH model 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:[EMAIL PROTECTED]] 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 tag; while from what I see in chapterTemplate.jsp, the 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: --- Topics Introduction Using Templates Optional Content ... and more ... . . . _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
RE: Template -struts-template and generated HTML / templating using PUSH model
Merci. I will have a look at it. For my problem, I use . . . heuh, Tomcat 3.2.1 :( I just tried with Catalina 4.0b1 and . . . wow, it works fine :) Does I need a special parameter in server.xml, something else ??? Vincent -Message d'origine- De : Cedric Dumoulin [mailto:[EMAIL PROTECTED]] Envoye : mercredi 28 mars 2001 11:06 A : [EMAIL PROTECTED] Objet : Re: Template -struts-template and generated HTML / templating using PUSH model Hi Vincent, Have a look to Components proposal. Components proposal can be seen as "extended templates". With Components you can define your template's contents/attributes in a separate file, and insert content by using its name. A content, named a component, can also inherit from other definitions. Components proposal also contains other features. See (main site) http://www.lifl.fr/~dumoulin/components (mirror) http://www.geocities.com/cedricdumoulin/components/ I am currently working on the possibility to define or modify the template/component inside the action or inside the jsp. This will be available soon (see a previous mail 'Re: PROPOSAL: Template Screens'). Furthermore, useful Components features will be progressively introduce in Struts version 1.1 For your first question, see intermixed. Cedric Vincent Harcq wrote: > 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 tag; while from what I see in chapterTemplate.jsp, the > should appear first. > Is there a problem somewhere ? Does somebody is aware of that ? Is it my > browser ? > What jsp server do you use ? This happens because your server doesn't flush included page. You can try to use the components library instead of template one, it is fully compatible. > > 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: > --- > > Topics > > > Introduction > > > Using Templates > > > Optional Content > > ... and more ... > > > > > > > > > > . . . > > _ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
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 tag; while from what I see in chapterTemplate.jsp, the 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: --- Topics Introduction Using Templates Optional Content ... and more ... . . . _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
Templating Mechanism
After reading the User Guide, I am not sure if Struts does have a Templating Mechanism or not. By that I mean one (or 2 or 3) that defines the basic structure of the site in 3 (for example) parts : a header, the left panel and a body. This template will always be the jsp:forward and have two jsp:include to include the two static (for example) header and left panes pages and one jsp:include that would get a parameter from the request to now which page to include. Something similar to the PetStore example. I like that because it push a lot of DIV or LAYER HTML code in only the template page. Is it possible ? _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com