Unless I am missing something... the only other ways to handle this would be:

1) Pass the information through the url.
2) Pass the information through the session.

No, neither of these are very good solutions.  Using sessions for too
much can cause problems with non-linear navigation, for instance when

A style I also use for all my sites is to have a simple list of messages
that get displayed at the top of the next page to be loaded.  So when a
This is the main reason that I switched to Cheetah and the "containment" mothod.

Basically my servlet processes any action, assembles the data into classes, and then just calls the appropriate template to render:

An internal user will see a completely differnt welcome page then client will. All of the logic is here in the servlet, and both templates are very clean.

if (user.employee):
#Internal guys need a class w/ info about thier clients
clientStats = CSData.clientStats(ClientList)
....
# Pull the template for an internal user
templateFile= os.path.join(
os.path.dirname(self.serverSidePath()),
'templates','WelcomeEmp.ctd')
t = Template( file=templateFile,
searchList=[{'user':user, 'boxContents':boxContents,
'ClientList':ClientList}])
else:
#Clients only need info about thier system
dataStats=CSData.summaryStats(user)
templateFile=os.path.join(
os.path.dirname(self.serverSidePath()),
'templates','Welcome.ctd')
t = Template(file=templateFile,
searchList=[{'user':user,
'boxContents':boxContents},dataStats])

#Finally just write out the template
self.writeln(t)

Want a skinnable site? just add a variable for a directoy to the os.path.join line. This is old code, now I precompile the templates in the servlet __init__ , but this method is a better example.

There are some issues doing things this way that a redirect will avoid. Hitting REFRESH on the brower will re-execute any actions. But you can code for that if needed as well.

I also use this method for things like a print preview or .xls download. If you want the data as a download I just call a cheetah template that looks like a tab delimited file and send that.

-Aaron



-------------------------------------------------------
This SF.NET email is sponsored by: FREE SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to