From: John D. <jdi...@te...> - 2005-02-02 15:01:13
|
ok, so you also have to pass the action name to preAction() and postAction(). def preAction(self,actionName): pass def postAction(self,actionName): self.writeHTML() --John John Dickinson wrote: > I assume you are inheriting from WebKit.Page. Look at the preAction() > and postAction() functions there. As those functions are implemented, > when you call an action, the doctype and header ar printed, then your > action is called, then any closing tages (body,html) are printed (this > is from memory, check the code to be sure). So when you call > writeHTML() from an action, some of what is going to be written has > already been written. On this list I read someone say that the default > implememtation of the actions is an anemic version of writeHTML(). > > My suggestion would be to do the following: > > ..in your servlet > def preAction(self): > pass > def postAction(self): > self.writeHTML() > > and don't write anything out to the screen in your action. > > --John > > lloyd wrote: > >> >> if i call self.writeHTML() from an action, it prepends a redundant >> header to the output : >> >> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >> "http://www.w3.org/TR/html4/loose.dtd"> >> <html> >> <head> >> <title>ServletNameInsteadOfCheetahTemplateTitle</title> >> </head> >> >> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> >> <html> >> <head> >> <meta content="text/html; charset=ISO-8859-1" >> http-equiv="content-type"> >> <title>Title set in cheetah template</title> >> <link rel="stylesheet" href="/common/style.css" type="text/css"> >> >> <script language="javascript" type="text/javascript" >> src="/common/lib.js"></script> >> >> </head> >> >> >> however, just accessing the servlet directly without an action does >> not prepend the redundant header. >> >> i don't use any methods in the servlet except writeHTML() because i >> use cheetah templates to generate the output, which i render with >> self.writeln(templateOutput) >> >> i have a feeling i may be using the class incorrectly; nor have i >> scoured my code yet - just wondering if anyone sees something >> glaringly obvious, or has come across this before. >> >> >> thanks >> >> >> ------------------------------------------------------- >> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting >> Tool for open source databases. Create drag-&-drop reports. Save time >> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. >> Download a FREE copy at http://www.intelliview.com/go/osdn_nl >> _______________________________________________ >> Webware-discuss mailing list >> Web...@li... >> https://lists.sourceforge.net/lists/listinfo/webware-discuss >> >> ______________________________________________________________________ >> This e-mail has been scanned by MCI Managed Email Content Service, >> using Skeptic(tm) technology powered by MessageLabs. For more >> information on MCI's Managed Email Content Service, visit >> http://www.mci.com. >> ______________________________________________________________________ >> >> > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting > Tool for open source databases. Create drag-&-drop reports. Save time > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. > Download a FREE copy at http://www.intelliview.com/go/osdn_nl > _______________________________________________ > Webware-discuss mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/webware-discuss > > ______________________________________________________________________ > This e-mail has been scanned by MCI Managed Email Content Service, > using Skeptic(tm) technology powered by MessageLabs. For more > information on MCI's Managed Email Content Service, visit > http://www.mci.com. > ______________________________________________________________________ > > ______________________________________________________________________ > This e-mail has been scanned by MCI Managed Email Content Service, > using Skeptic(tm) technology powered by MessageLabs. For more > information on MCI's Managed Email Content Service, visit > http://www.mci.com. > ______________________________________________________________________ > > |