struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fredrik Lindberg <fredri...@gmail.com>
Subject Re: Redirect-action alternative in Struts2 without browser redirect
Date Fri, 28 Sep 2012 05:38:37 GMT
Hi!

It is not always possible to go via the dispatcher. The JSPs have
dependencies on what properties the actions need to provide and giving
every action have the same properties would be bad design.

Don't you agree that you sometimes need to use the redirect-action? In
that case why could Struts2 not just provide a different result-type
that skips the browser redirect and just returns the result of the
following action right away? I believe I have seen this possibility in
other frameworks and the only bad thing I have heard from others here,
so far, is that the URL will not show correctly in the browser.

/ Fredrik Lindberg (2012-09-28).

On Wed, Sep 26, 2012 at 10:48 PM, Chris Pratt <thechrispratt@gmail.com> wrote:
> I think you're missing the point.  The right way to do what you're doing is
> with the dispatcher.  You have your server side logic perform it's
> calculations and ministrations, when it's done it returns a string telling
> the "presentation side" what should happen next.  Which should be using the
> dispatcher to dispatch your JSP to the browser.  If you're adamant about
> keeping the two separate (which is not the "struts 2 way"), you will either
> have to continue to redirect or chain, there really is no other way.  I
> believe what you are really trying to accomplish is what the dispatcher is
> doing.
>   (*Chris*)
>
> On Wed, Sep 26, 2012 at 11:08 AM, Fredrik Lindberg <fredricus@gmail.com>wrote:
>
>> Look, I already wrote why I would not want to use the chain result
>> type. Also I did not write anything about redirect that you are
>> quoting. I wrote "forward" and followed what was written here:
>>
>> http://struts.apache.org/2.1.6/docs/dispatcher-result.html
>>
>> Are you really trying to be helpful?
>>
>> / Fredrik Lindberg (2012-09-26).
>>
>> On Wed, Sep 26, 2012 at 8:42 PM, Chris Pratt <thechrispratt@gmail.com>
>> wrote:
>> > I will correct you, because you are wrong.  The dispatch result type is
>> the
>> > direct streaming result type that processes JSP and streams the generated
>> > HTML directly to the browser.  That is not the same as the "redirect"
>> > result, which streams a 302 result code and a "location" header to the
>> > browser.  If you are trying to make the result of one action the input to
>> > another action without involving the browser, you'll need to use the
>> > "chain" result.
>> >   (*Chris*)
>> >
>> > On Wed, Sep 26, 2012 at 10:38 AM, Fredrik Lindberg <fredricus@gmail.com
>> >wrote:
>> >
>> >> Hi!
>> >>
>> >> Forward is, correct me if I am wrong, what you get when you use the
>> >> dispatch result type, but as far as I have been able to tell you can
>> >> only forward to a view, like e.g. a JSP. I want to however "forward"
>> >> to another action without the round-trip of a redirect. In other
>> >> words, I want to switch, based on the result of the first action,
>> >> which action is being executed before the system determines which view
>> >> to use.
>> >>
>> >> Yes, having to do some kind of interceptor for this seems like very
>> >> complicated.
>> >>
>> >> / Fredrik Lindberg (2012-09-26).
>> >>
>> >> On Wed, Sep 26, 2012 at 7:41 PM, Dave Newton <davelnewton@gmail.com>
>> >> wrote:
>> >> > On Wed, Sep 26, 2012 at 12:30 PM, Fredrik Lindberg wrote:
>> >> >
>> >> >> I am looking for if there is any alternative to the redirect-action
>> >> >> result type where it does not generate a browser redirect?
>> >> >
>> >> >
>> >> > It's not clear to me what you want.
>> >> >
>> >> > Do you want to *forward* to another action? I've never tried it, but
>> did
>> >> > you try the normal dispatch result?
>> >> >
>> >> > Also why not send what the client wants right away?
>> >> >
>> >> >
>> >> > Because it's a redirect?
>> >> >
>> >> >
>> >> >> What I want is having control over what properties are
>> >> >> passed on to the next action in the same way as for the redirects,
>> but
>> >> >> without the overhead. Can anyone help? =)
>> >> >>
>> >> >
>> >> > I suppose you could configure the parameter filter interceptor for
>> each
>> >> > action, but ugh.
>> >> >
>> >> > Dave (2012-09-26... well that seemed redundant; does your email client
>> >> not
>> >> > show dates?)
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
>> >> For additional commands, e-mail: dev-help@struts.apache.org
>> >>
>> >>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
>> For additional commands, e-mail: dev-help@struts.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message