Tim Lavoie wrote:
> Hi all,
> I'm new to Webware, but have been using other web environments for a
> loooong time. What I would like to do is to use Webware for a core
> controller, forwarding to Cheetah for display. Think of Struts, if you
> know that.
> I've got a couple main questions to start off:
> To forward using the actions from Webware is simple, but what is the
> best way to include data from the controller which isn't in the
> original request? This could be database results, error messages or
> whatever. I was thinking mainly of bundling these into the request,
> but am not sure how. Sessions could do the trick, but I'd prefer to
> avoid long URLs or mandatory cookies at the moment.
You can modify the request object however you please before calling
forward(). Just do:
And that key/value pair will be available to the servlet you forward to.
You might also be able to just directly set attributes of the Request
self.request().newattribute = 'newvalue'
But I haven't tested that.
> Also Cheetah-related, but what is the best way to have other
> servlets available for forwarding, but not directly callable by an
> end-user? This is essentially just the pretty display code for a set
> of pages, but I don't want anyone able to call up templates which
> haven't been called by the Webware servlet.
Hmmm. That's a good question. I can only think of 2 ways, neither one very
1) Add a special "forwarded" attribute to the request object before
forwarding, and test for the presence of that attribute in the request in
all of the "hidden" servlets and if you don't find the attribute, send back
an error page.
2) Use Apache directives to hide the hidden servlets. I'm sure there's a
way to do that.