Okay. A question for another approach: is there a way to save an ActionMapping (ActionConfig) into a page, that I´m able to recall later on? The idea is the following regarding the login-problem: I´ve defined a base-action that does a check if roles are defined in the ActionMapping. If this is the case it checks for the authentification and authorization. If one of these checks fail I redirect to a loginPage referenced through a global forward. If I could save the original ActionConfig in this loginPage, I could redirect the user to the page he originally wanted to go, if the login succeeds. My first idea was to save a String into a hidden field, but that would not work with objects as ActionConfig. Is there a possibility to save objects into the pages as I can do it with sessions?
Thanks a lot Thomas Am Freitag, 1. September 2006 00:55 schrieb Paul Benedict: > I have actions like this: > > <action path="loadPerson" /> forwards to edit > <action path="editPerson" /> displays page > <action path="savePerson" /> forwards to previous page > > If you think about what these mappings are, they are really actions > (functions) of a person page. You go to a page to view a person and then > you use the page to save a person. > > loadPerson and savePerson are what I call business actions. Because they > perform some heavy operation and then forward off to some view. My > editPerson is an action specifically for viewing data; it takes data > already loaded and saves it. Which of these would be "pages"? only > editPerson, imo, since it's purpose is to render data. > > You should read Michael's article on it. It's excellent > http://today.java.net/pub/a/today/2005/08/04/jspcomponents.html?page=1 > > Paul > > 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] -- Mit freundlichen Grüßen Thomas Hamacher ----------------------------- Thomas Hamacher QualiGO GmbH Bleicherstrasse 20 D-78467 Konstanz Germany fon: +49-(0)7531-89207-0 fax: +49-(0)7531-89207-13 mail: [EMAIL PROTECTED] www: www.qualigo.de --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]