I know with cheetah you can pull the text from any source and compile it into a template via
tempDef = functionToPullTemplateStringFromDatabase t = Template(tempDef,[orderData]) Another trick I like is to precompile the template and then use it normally. self.compTemplate = Template(tempDef) self.compPrintTemplate = Template(printTempDef) Where tempDef if the teplate for a normal page and printTempDef is the template for a "priter friendly page" and then use something like: if (self._printThis==0): t = self.compTemplate print "in normal template" else: t = self.compPrintTemplate print "in Print template" t.pagedata = pagedata self.writeln(t) but you would need some mechanism to see when the template changes, and if you have lots of templates then this will cause some memory overhead. (# of templates * # of pages * number of threads) So in my little example I have up to 200 templates classes for two different views of one page. But it is fast, and memory is cheap. -Aaron ----- Original Message ----- From: "Ernesto Revilla" <[EMAIL PROTECTED]> To: "Webware" <[EMAIL PROTECTED]> Sent: Thursday, April 25, 2002 11:18 AM Subject: [Webware-discuss] MVC and Servlets > Dear all, > > earlier we saw how a MVC design could be used to clearly separate Content > from Presentation. > > We could use PSP or Cheetah for the presentation. > > 1. I heard there is a way in PSP to pull out the templates from a database > and call the a method to execute it. How is this done? > Could I use a test-dir to test new templates, or versions or whatever? > How can I activate the PSP templates manually? > Is Cheetah more appropiate for this? > > 2. When creating a complex data structure, for example an order, where I > have to need several pages to pick up the data from the user (pick up > customer, articles, and other conditions), how should I procede to store the > information finally? Should I store all the data collected with sevaral > pages in the session until she completed the information (e.g. order) and > the last page would forward it to the database? > This would be that we have an 'OrderController' which activates (using the > workflow control) different pages to collect the information, but we have to > store it in the session object, because each request instantiates a new > instance of the 'OrderController' Servlet (class), right? The last page > would activate the 'save' method of the controller, and this would pull out > all info out of the session and send it to the database. > > Up to how much data is reasonable to store in a session using a average good > machine (some PIV with 512MB RAM) with 20 users? > > Thanx a lot, > Erny > > > > > _______________________________________________ > Webware-discuss mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/webware-discuss > _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss