Hello.

I tried my best before posting this and searched through the archives, but
couldn't find anything on this.

I recently came across a team which was doing something which seemed a
little "weird" more from a designer's (purist?) perspective. 

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)
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.

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.
B. Is Struts intended to be used as above, by returning a null action
forward?
        By design, when a method has a return type R, that becomes part of
the contract, and the caller may typically assume that to be the returned
type. Yes, checking for nulls would be a good thing - and necessary. But, it
becomes the responsibility of the implementor to adhere to that contract.
        However, from the point of view of someone only looking at the
Action which returns a null, things will be very fuzzy unless they know how
Struts is likely to handle it: some folks may assume, it could result in an
exception while others may think it is perfectly ok.
        What is a better way to achieve the same thing?

Any thoughts and discussion much appreciated.
 
Rgds,

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." 


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

Reply via email to