Hi Nils-H,

Thanks for the reply, unfortunately in production we got lot of
functionalities written with #session.studentId  etc, in the jsps to access
PORTLET APPLICATION SCOPE variables.

Those references are not only <s:property value= "#session.studentId"> but
<s:if test="#session."

As suggested by you if we want to fix this we need to use the portlet tag
library and introduce bit of scripting to access the raw portlet session.
This involves bit of coding, also not sure how to code <s:if
test="#session........  might have to introduce jstl if etc.......


Without doing that way, I though why not introduce a interceptor that will
put all the portlet application scope variables to the portlet session
scope. This way, there would not be any jsp code change. I tried this
approach and worked beautifully, basically introduce a interceptor ref
my-sessionScopeHandler to the bottom of the following stack.

But certainly for new developments I agree with what you stated


<interceptors>
<interceptor name="portlet-preferences"
class="org.apache.struts2.portlet.interceptor.PortletPreferencesInterceptor"/>
<interceptor name="my-sessionScopeHandler"
class="my.SessionApplicationScopeHandleInterceptor" />

<interceptor-stack name="portletDefaultStack">
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="portlet-preferences"/>
<interceptor-ref name="my-sessionScopeHandler"/>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="portletDefaultStack"/>



What is your opinion regarding this, practically I prefer this option,

Pls let me know your thoughts in terms of issues which can pop up by doing
this.

Thanks




Nils-Helge Garli wrote:
> 
> Ah, sorry, I think I misunderstood....
> 
> As they say in the uPortal forum, this is probably due to the older
> version of uPortal returning all session attributes regardless of
> scope. When this was fixed, you need to specify the correct scope to
> retrieve application scoped attributes, but they are still in the
> session. The "application" object is for attributes in the
> PortletContext (or ServletContext if it's a servlet). Since the
> session is represented as a Map object in Struts 2, there is no
> support for "scope" (just simple "get" and "put" operations). To
> retrieve the application scoped session attribute, you need to do as I
> suggested in the previous reply, get the raw session and access it
> directly.
> 
> Nils-H
> 
> On Wed, Jul 22, 2009 at 8:50 AM, Nils-Helge Garli
> Hegvik<nil...@gmail.com> wrote:
>> Does it work if you access the session "raw" (get the session and do
>> session.getAttribute("studentId", PortletSession.APPLICATION_SCOPE)?
>> Have you tried deploying to a different portlet container such as
>> jboss portal or just plain pluto? I assume that the resources you're
>> sharing session between are in the same war file? Unless you're
>> calling "clear()" on the session map, Struts 2 doesn't do anything to
>> the session, so it should not just disappear like that. Considering
>> you're using the same Struts 2 version in both deployments, I'm not
>> sure what could be wrong...
>>
>> Nils-H
>>
>> On Wed, Jul 22, 2009 at 3:48 AM, Tracy12<j_lal...@yahoo.com> wrote:
>>>
>>> Hi,
>>>
>>> We got a  struts 2.0.6 portlet application with uPortal  2.5.3 ( inside
>>> Pluto 1.0.x) with no issues and running fine.
>>>
>>> Now we deployed the same struts 2.0.6 application in uPortal 3.1.1
>>> (inside
>>> pluto 1.1.7) and found following issue.
>>>
>>> in our action classes we had the following,  where session is of type
>>> PortletSession.
>>>
>>> session.setAttribute("studentId","1111111",PortletSession.APPLICATION_SCOPE)
>>>
>>> We trieved the above studentId in the jsp as follows.
>>> <s:property value="#session.studentId"/>
>>>
>>> The above worked with no issues in uPortal 2.5.3 but with uPortal 3.1.1
>>> this
>>> is not working,
>>> Then I tried the following
>>> <s:property value="#application.studentId"/> but didnt work,
>>>
>>>
>>> I  interacted with the uPortal forum and this is what it
>>> tells...http://www.nabble.com/Re%3A-is-this-a-bug-in-struts2-portlets-td24581733.html
>>>
>>> I thought based on that <s:property value="#application.studentId"/>
>>> should
>>> work,
>>>
>>> What else could I try, This looks to me a bug. Can't understand why it
>>> is
>>> not in the value stack.
>>>
>>> If not pls let me know how to retrieve the above
>>> PortletSession.APPLICATION_SCOPE variable in the jsp.
>>>
>>> If this has been fixed let me know which struts 2 version is that.
>>>
>>>
>>> I did try the following also with no luck
>>>
>>> <s:property value="%{#application['studentId']}"/>
>>>
>>> waiting for a quick reply
>>>
>>>
>>> Thanks
>>>
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Struts2-portlet-bug-found-tp24598748p24598748.html
>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts2-portlet-bug-found-tp24598748p24671932.html
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to