Re: How to set session data based on request parameters and how to retrieve session values correctly via OGNL

2008-06-10 Thread Dave Newton
--- On Tue, 6/10/08, Gamble, Wesley (WG10) [EMAIL PROTECTED] wrote:
 Should I use an interceptor for this?

Depends.

 How does the interceptor get access to the request variables?

See the ServletConfigInterceptor source, also viewable online [1]. (The version 
doesn't matter too much in this case.)

 title ${#session['companyName']}

You're mixing JSP EL with OGNL.

http://struts.apache.org/2.x/docs/ognl.html

Dave

[1] 
http://svn.apache.org/viewvc/struts/struts2/tags/STRUTS_2_1_2/core/src/main/java/org/apache/struts2/interceptor/ServletConfigInterceptor.java?revision=652750view=markup


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



Re: How to set session data based on request parameters and how to retrieve session values correctly via OGNL

2008-06-10 Thread Lukasz Lenart
Hello!

2008/6/10 Gamble, Wesley (WG10) [EMAIL PROTECTED]:

 1) I would like to set some session key-value pairs in response to a
 request parameter so that I can count on these session variables
 throughtout my application.  Should I use an interceptor for this?   How
 does the interceptor get access to the request variables?


Your action class has to implement SessionAware interface and simply add
your key-value to Map provided by setSession(Map session), that's all, no
magic ;-)


 2) Assuming that I have correctly set my session values, how do I
 correctly use them in a JSP.


s:property value=#session.yourKey/


Regards
-- 
Lukasz
http://www.lenart.org.pl/


RE: How to set session data based on request parameters and how to retrieve session values correctly via OGNL

2008-06-10 Thread Gamble, Wesley (WG10)
But I want this to happen for every action - and it is dependent on the
request data that comes in.

Wes

-Original Message-
From: Lukasz Lenart [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 10, 2008 2:51 PM
To: Struts Users Mailing List
Subject: Re: How to set session data based on request parameters and how
to retrieve session values correctly via OGNL

Hello!

2008/6/10 Gamble, Wesley (WG10) [EMAIL PROTECTED]:

 1) I would like to set some session key-value pairs in response to a
 request parameter so that I can count on these session variables
 throughtout my application.  Should I use an interceptor for this?
How
 does the interceptor get access to the request variables?


Your action class has to implement SessionAware interface and simply add
your key-value to Map provided by setSession(Map session), that's all,
no
magic ;-)


 2) Assuming that I have correctly set my session values, how do I
 correctly use them in a JSP.


s:property value=#session.yourKey/


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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



Re: How to set session data based on request parameters and how to retrieve session values correctly via OGNL

2008-06-10 Thread Lukasz Lenart
2008/6/10 Gamble, Wesley (WG10) [EMAIL PROTECTED]:

 But I want this to happen for every action - and it is dependent on the
 request data that comes in.

Then you should implement Interceptor and investigate
ActionInvocation.getInvocationContext() .getParameters()


Regards
--
Lukasz
http://www.lenart.org.pl/

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



RE: How to set session data based on request parameters and how to retrieve session values correctly via OGNL

2008-06-10 Thread Gamble, Wesley (WG10)
Should ActionInvocation.getInvocationContext().getParameters() give me a
Map of request parameters or do I need to pull the HttpServletRequest
object in another way?

I've seen some code online where the HttpServletRequest gets pulled.

Thanks,
Wes

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



Re: How to set session data based on request parameters and how to retrieve session values correctly via OGNL

2008-06-10 Thread Lukasz Lenart
2008/6/10 Gamble, Wesley (WG10) [EMAIL PROTECTED]:
 Should ActionInvocation.getInvocationContext().getParameters() give me a
 Map of request parameters or do I need to pull the HttpServletRequest
 object in another way?

No, just use getParameters() to get raw parameters access


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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