You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tracy12 <j_...@yahoo.com> on 2009/07/22 03:48:43 UTC

Struts2 portlet bug found

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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts2 portlet bug found

Posted by Tracy12 <j_...@yahoo.com>.
For some reason whole application looks very slow,
I might choose the other approach where do jsp code changes to access raw
Portlet Session.

Doest this mean I have to use <s:if test="#session.studentId"  to JSTL
version of this.



Tracy12 wrote:
> 
> 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<ni...@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_...@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-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>> 
>> 
>> 
> 
> 

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


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


Re: Struts2 portlet bug found

Posted by Tracy12 <j_...@yahoo.com>.
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<ni...@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_...@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-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts2 portlet bug found

Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
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<ni...@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_...@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-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>

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


Re: Struts2 portlet bug found

Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
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_...@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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


RE: Struts2 portlet bug found

Posted by "Kofford, C Todd" <tk...@ku.edu>.
Since this deals with struts and uportal I have copied the uportal user
group in this response too.

I had a similar problem. See email thread below:
http://www.mail-archive.com/user@struts.apache.org/msg87615.html 

I was simply using the session (map) object from a SessionAware action
class and not explicitly using PortletSession. This is because we run
our struts 2 webapp both as a portlet and a standalone webapp, and
wanted to handle the session in a consistent way. I applied the uportal
fix (mentioned in the email thread) to my uportal 2.5.x installation and
MY problem was solved. 

We are just now moving to uportal 3.1.1 and are still on struts 2.0.14
due to an issue running struts 2.1.6 webapps as standalone and portlet
simultaneously. But so far, I have not seen the problem you describe
when testing my struts 2 portlets in uportal 3.1.1. 

Todd Kofford
tkofford@ku.edu
University of Kansas - IT

-----Original Message-----
From: Tracy12 [mailto:j_lalith@yahoo.com] 
Sent: Tuesday, July 21, 2009 8:49 PM
To: user@struts.apache.org
Subject: Struts2 portlet bug found


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_SC
OPE)

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-td
24581733.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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


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