Thanks a lot, for all the responses. That helps!
Saurabh Bobde ~~~~~~~~~~~~~~~~~~~~~~~~~~~ "DISCLAIMER: The information contained in this e-mail message may be privileged, confidential, and protected from disclosure. If you are not the intended recipient, any further disclosure or use, dissemination, distribution, or copying of this message or any attachment is strictly prohibited. Please ensure you have adequate virus protection before you open or detach any documents from this transmission. Zensar Technologies Inc. does not accept any liability for virus. If you think that you have received this e-mail message in error, please delete it and notify the sender." -----Original Message----- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Friday, March 10, 2006 6:35 PM To: Struts Users Mailing List Subject: Re: Struts Action returning null - Design query? 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]