Hey Grabiel,

Thanks for the link, now it works, but I two questions :
1. About my problem, in the configuration, I am using
CreateSessionInterceptor to create a session. And in the logs, I can
see that the first time the JSP is looking for the variable, the
session exisits but is empty (while I set the value in the action, but
with HttpSession), the second time, the session contains the value. Do
you think this behaviour is normal ?
2. In which case should we use the "context" session and in which case
should we use the HttpSession ? For example, in
CreateSessionInterceptor it uses the HttpSession, but then in the
actions it seems to be recommended to use the "context" session.

Thanks !

Cimballi


On Thu, Jan 14, 2010 at 5:31 PM, Gabriel Belingueres
<belingue...@gmail.com> wrote:
> This way of obtaining a Session I think is not a good idiom.
>
> May be there are things that happens behind the scene when obtaining a
> session, that's probably why you are not getting a NPE the first time
> you call getSession(false) in your code...because "something" already
> created it.
>
> S2 have a Map abstraction of session:
> http://struts.apache.org/2.1.8.1/docs/how-do-we-get-access-to-the-session.html
>
> HTH
>
> 2010/1/14 Cimballi <cimballi.cimba...@gmail.com>:
>> Hi,
>>
>> I have a problem with a JSP and the session the first time I call the
>> action which redirects to the page.
>> The action sets a variable in the session using the code :
>> final HttpSession session =
>>   ServletActionContext.getRequest().getSession(false);
>> session.setAttribute(name, value);
>>
>> Then, the action redirects to a page where there is a select tag like :
>> <s:select name="xxx" list="#session.sessionValue" />
>>
>> If I start the application, the first time I call the page I have the
>> following error :
>> org.apache.jasper.JasperException: tag 'select', field 'list', name
>> 'xxx': The requested list key '#session.sessionValue' could not be
>> resolved as a collection/array/map/enumeration/iterator type. Example:
>> people or people.{name} - [unknown location]
>>
>> On the second call, it works. Note : I am using a specific
>> interceptors stack, so the problem could come from there, even if I
>> doubt.
>>
>> Do you have any idea about where the problem can come from ?
>>
>> Thanks,
>>
>> Cimballi
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to