On 3/10/06, Saurabh Bobde <[EMAIL PROTECTED]> wrote:

> After processing a request, the Action would simply return a null
> ActionForward,  like so: return (null);
>
> One of the scenarios why/where they were doing this was, they needed to
> write to the response directly. (For eg, returning the contents of a file
> dynamically)

Okay.

> Also, the behavior they are expecting is, that by simply returning a null,
> the page stays on the browser/client, and the returned response, may be
> opened in another window, depending on the content-type returned.

(I don't think you can open new windows from the server side.  But
they could have opened the new window from the client side and and
made the request from there, so I'll ignore this point.)

> Questions that I would like to ask are:
> A. Is this the right way to be using Struts? In my opinion, this kind of
> procssing should really be handled using simple servlets (along with other
> helper classes)  rather than Struts-Action-type classes.

A matter of opinion.   If everything is done with Struts, it's just
natural to write another Action to do whatever it is you want to do. 
And you may want to take advantage of some framework features that
wouldn't be available in a servlet.  I do use simple servlets for
things that have nothing to do with Struts, (converting some text to
PDF based on a session attribute,) but I wouldn't call it wrong to do
otherwise.

> B. Is Struts intended to be used as above, by returning a null action
> forward?

Yes, in fact it's mentioned in the Javadocs for Action.execute(...). 
The framework "knows" that a null return value means that the response
has been dealt with, and it shouldn't do anything further.
 * http://tinylink.com/?PHJLxqCMze

HTH,
--
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to