On 5/8/05, Joe Germuska <[EMAIL PROTECTED]> wrote:
> At 4:19 PM -0700 5/8/05, rmanchu wrote:
> >i have to following scenario.
> >
> >interface1 =>action1 => action2 => interface2
> >
> >is calling another action from an action discouraged in struts?
> >
> >what's the best solution for this? 1.2.4 to 1.3-dev
> 
> You'll find plenty of discussion on this in the mailing list archives
> and in the Wiki.  In short, when you use an action as the path of an
> ActionForward, you cause Struts to re-execute its request processing
> process a second (or third or Nth) time.  While this works for many
> people in many cases, it is not something which Struts was explicitly
> designed to support, and unexpected effects in the context of "action
> chaining" are unlikely to be considered "bugs".
> 
> In Struts 1.3, you may well be able to use commons-chain and Struts
> ability to execute a chain command as configured in an <action>
> mapping so that you don't actually need to chain actions; then again,
> perhaps the actions in the chain actually depend on the effects of
> re-executing the request processing process, so even then, chaining
> commands may not be enough.
> 
> Joe

Web application uses HTTP as a backbone, and this fact MUST be
remembered at all times. Some frameworks like WebWork claim that they
are better than Struts only because they do not have dependency on
core HTTP/Net classes. My opinion is different: it is impossible to
create well-behaved web application without understanding how HTTP
works, and without using its features and working around its
deficiencies.

While chaining may improve separation of tasks, there is one thing
about chaining that makes it irrelevant for the web: CHAINING IS
PERFORMED ON THE SERVER. There is no difference from browser's point
of view, was request chained or not, when it recieves page from server
in response to POST request.

My strong opinion, that data input and view output must be separated.
Not only logically on the server, but physically on the protocol
level. Input must be done with POST, and page must be loaded with GET,
this is how HTTP was designed. This solves all problems with action
chaining?

Separating of input and output into POST and GET requests makes two
requests out of one, with redirect response between them. Server does
not even has to know that the GET request is redirected, it simply
displays object which was requested. Becuase this approach makes two
separate requests out of one, technically, this is not chaining ;-)
And it works beatifully.

Struts does not have to support this kind of chaining, because this is
not chaining for Struts, this is two separate requests.

Michael.

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

Reply via email to