In Struts 1.3, if you don't specify the action name on the form tag, Struts will automatically post the form back to the current page. If you wrote a chain command that intercepted that post, you could perform the login, then let the request continue on, which would result in the original page being displayed. Perhaps that'll get you most of the way there.

Don

Thomas Hamacher wrote:
Paul,

thank you very much for your answer... but let me ask you for a few more details: I understood that I need a separation between simple pages and the pages, that do some business logic and that I should do that through an additional property in the ActionMappings of the struts-config.
But where would I receive this ActionMapping and where should I save it?
Furthermore is there a way to save an ActionMapping in a page? How to do that?

I would be very thankful if you could give me some more information about your idea. It sounds very interesting but I don´t really know what to do yet..

Thanks a lot

Thomas

Am Donnerstag, 31. August 2006 02:51 schrieb Paul Benedict:
About a month ago I recommend this same thing. The problem really is
that Struts has no concept of a page, so it's impossible to tell the
difference between actions that perform business logic and actions that
just front rendering of a page.

You really need a page-based framework to make this happened. My
personal recommendation was to include a "page" property on each action
mapping which you consider a page. Then in the controller, the last URI
can be tracked if this attribute is present in the action mapping. I
really recommend this approach to you.

It's such a custom solution though that I couldn't recommend it to be
included into the Struts Framework. If Struts ever does involve into a
page-based controller, then there is leverage to do such a thing... but
at the present time you can totally emulate what you need by what I said
above.

Paul

Thomas Hamacher wrote:
Dear everyone,

after spending a lot of time with googling and multiple tries with
different approaches and also my questions to the struts-user-mailinglist
didn´t come to a solution, I would like to as you guys if there is a way
or not. So I´m sorry, if I use the developers-list for a stupid
user-question, but I don´t know any place else I might find a solution to
this problem:

My question is: Does the struts-framework provide a possibility to
forward back to the page you came from?

I can´t believe, that I´m the only one, who has this problem and I don´t
think there is no struts-conform solution. Let me give you the following
scenarios so that you know what I´m talking about.
- I wanna show a login-box on every page. If the user logs into the
webpage, the login-action executes and afterwards the user is redirected
to the page he has been before, but the userMenu is displayed instead the
login-box. If the authorization fails, he´ll be redirected to the same
page, showing im an error-message
- On top of every page is a possibility to change the language through
clicking on a button with a language-flag. After changing the locale, the
user will be redirected back to the page he came from, but using a
different language.

These are only 2 examples to get an idea, what I´m talking about. I tried
the following:

- using the referrer from the request. But this could not be a solution,
as it is not struts-conform and there are many possibilities, that the
referrer might not be availabe
- using the ActionMapping-Object´s input-Value. This doesn´t work
together with tiles, as the input-value is only part of the tile, but I
need the information of the "parent"-tile. Furtermore this doesn´t work
if the last action was a ForwardAction. Other attributes in the
mapping-object only refer to the next page, but not the current page.
- saving the last ActionForward in the session. This does only work, if
the user uses one browser-window and does never use the back-button,
because otherwise he´ll be redirected to an unexpected page.
- saving the tiles-definition in a hidden field on the jsp-page. This
would prevent the problem with the unexpected page, but does only work,
if a form will be submitted, that has a hidden-field with this value. Or
is there a way to put a parameter into the request without submitting a
form and without adding it to the URI.
- Adding a forward to every ActionMapping and extend the BaseAction to
forward to a specified forward. This won´t work, because of tiles as
well. Unfortunately you never know, which pages include this tile, so you
can´t use a static forward.

So I´d expect a solution somewhere near the RequestProcessor, but
especially with the ComposableRequestProcessor, this goes very deep into
the struts-architecture. I´m open to do this, but I don´t know the place
where to look at.
Is there a way I haven´t looked at or does anyone have an idea how to
solve this, as you probably know the struts-processes a lot better than I
do. Or is there a special reason, that this could not be implemented into
the struts-framework because of technically restrictions?

I´d greately appriciate any help to this topic. Sorry for asking this
question in the developers-list again, but I don´t know any other place
to ask for a solution, as I could not get any information to solve this
problem.

I hope, someone knows a solution to this or might share some ideas.

Many thanks

Thomas

---------------------------------------------------------------------
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]



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

Reply via email to