I guess i should add explanation.
i want to save an object permanently on the value stack.
In my case this object holds many informations that configure my pages
(loginuserid.......). It is created inside my loginAction.
I can get it from an action with a get-Method, but this object is
permanent and doesnt matter for any action beside login/logout. But the
jsp uses it every time.
I could put this object into the session (which i currently do). But i
like the value stack, and prefere lines like "#Settings.loginUser.id"
instead of "#session.settings.loginuser.id"
Hope i could explain my "problem"
Greetings,
Laures
Sébastien Domergue schrieb:
Hi,
reading your mail, it seems to me that you want te redevelop what
Struts 2 can already do. When you put a getter in your action, you can
access to your attribute in the jsp like you seems to want to. I can't
understand why you want to put another Interceptor. If it is to set
always the same value, you could use hierarchy to have a class that
deal with all of the common attributes and all of the others should
inherit from it and implements their owns attributes.
If it is a misunderstand from me, sorry...
regards
Sébastien
Alexander Baetz a écrit :
Hi,
currently i'm trying to use my own Class to store configuration data
for my application.
To access the options from within the jsp page i want to use the
struts 2 value stack. I somehow like the stack more than i like the
session.
My problem is the following:
i can put objects in the session, but how do i put one on the stack
so i can find it with something like:
value="#mySettings" ?
my current SettingsInterceptor looks like this (and doesnt work):
// get the action on which the interceptor is fired
Object action = actionInvocation.getAction();
// get the value stack
ValueStack stack =
actionInvocation.getInvocationContext().getValueStack();
// try to retrieve the bean
SettingsBean settings = (SettingsBean)
stack.findValue("mySettings");
if (settings == null) {
settings = new SettingsBean();
stack.set("mySettings", settings);
}
try {
((SettingsBeanAware) action).setPageSettingsBean(settings);
} catch (Exception e) {
}
return actionInvocation.invoke();
Greetings,
Alexander
---------------------------------------------------------------------
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]