My question is: Does the struts-framework provide a possibility to forward back to the page you came from?
Not as a standard feature, no. It's come up several times over the year, but, AFAIK, no one has contributed an elegant solution. When implementing the use case myself for Struts 1, I've done things like store a reference to the mapping as hidden field, or embedded in the link, so that when these "there and back again" actions execute, they know which action mapping created the link (which created the request, which fired the action, ...). It gets messy since pages that carry the "there and back again" links need to know to embed the current action details, and the "there and back again" action classes need to know to look for a seminal action. (And to go somewhere if it is missing.) One clarification is that we probably don't want to know the "page" or the action forward, but the action mapping. We need to transfer to the do. In Struts 1.3, the forms support the notion of posting back to the action which rendered the page. You might look to that code as a starting place. HTH, Ted. On 8/30/06, Thomas Hamacher <[EMAIL PROTECTED]> 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]
-- HTH, Ted. * http://www.husted.com/struts/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]