You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Gaurav Daga <to...@gmail.com> on 2014/03/12 23:33:05 UTC

Struts2 URL generation for Portlet AJAX

Hello All

I am using following construct to generate AJAX endpoint in a portlet
application (JSR-286 based).

<s:url action="/CaseTaskPortlet/view/ScrollingAction.nextRecords"
portletUrlType="resource" id="nextURL" />

I have a form field to be carry forward on multiple pages and it started
coming as array. While troubleshooting, I noticed that request is bringing
this value twice. Also in AJAX call from jQuery function I ensured that
data getting submitted has only one value.

I investigated it further and then I found that generated url, is capturing
values from the action stack.  And it carry forward old value stack to next
values. Now I dont want to carry forward these values, what are my options?
 I tried includeContext="false", and includeParams="none", both didn't give
me desired results.  Can someone please help me to "not to include values
from the old stack"?

Here is example of what is happening:

*First request execution *
[3/12/14 15:16:48:572 PDT] 00000023 SystemOut     O Key :
struts.portlet.mode
[3/12/14 15:16:48:572 PDT] 00000023 SystemOut     O Value : Values :
0 view
[3/12/14 15:16:48:572 PDT] 00000023 SystemOut     O Key : selectedOfficeCode
[3/12/14 15:16:48:572 PDT] 00000023 SystemOut     O Value : Values :
0 CO
[3/12/14 15:16:48:572 PDT] 00000023 SystemOut     O Key :
struts.portlet.action
[3/12/14 15:16:48:572 PDT] 00000023 SystemOut     O Value : Values :
0
/CaseTaskPortlet/view/CaseTaskPortlet/view/TaskViewAction.navigateToApplications

*Second request execution *


3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O +++++++++++++++++
Resource Request +++++++++++++++++++++
[3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Key :
pagingBean.commandTypeCode
[3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Value : Values :
0 taskViewCMD
[3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Key :
struts.portlet.mode
[3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Value : Values :
0 view
1 view
[3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Key :
pagingBean.pageSize
[3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Value : Values :
0 20
[3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Key : selectedOfficeCode
[3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Value : Values :
0 CO
1 CO
[3/12/14 15:16:56:556 PDT] 00000023 SystemOut     O Key :
struts.portlet.action
[3/12/14 15:16:56:556 PDT] 00000023 SystemOut     O Value : Values :
0 /CaseTaskPortlet/view/CaseTaskPortlet/view/ScrollingAction.nextRecords
1
/CaseTaskPortlet/view/CaseTaskPortlet/view/TaskViewAction.navigateToApplications
[3/12/14 15:16:56:556 PDT] 00000023 SystemOut     O Key :
pagingBean.officeCode
[3/12/14 15:16:56:556 PDT] 00000023 SystemOut     O Value : Values :
0 CO



*Thanks & Regards/ **सादर**,*
*Gaurav Daga*
*togauravdaga@gmail.com <to...@gmail.com> | +1.201.308.3242 | Web
Presence <http://goo.gl/lW0nh>  *
Do not follow where the path may lead. Go instead where there is no path
and leave a trail. - Harold R. McAlindon

Re: Struts2 URL generation for Portlet AJAX

Posted by Gaurav Daga <to...@gmail.com>.
Hello Lukasz

I guess I figured it out, exactly what is happening. Its not Struts rather
it WebSphere Portal URL Generation logic which puts the old parameter as
part of the URL. And this too happens when you are generating URL for
serveResource/AJAX calls for JSR 286 Portlet. I used in build WebSphere
Portal functionality for decoding the Portal URL and generated Resource URL
using Standard Portlet Tag library.  It concluded that its Portal which is
retaining the old values, probably because it want to maintain the state of
previous page.

(My response my sound confusing, but if you want I can share the code
snippet and analysis with you. )

Thanks.




*Thanks & Regards/ **सादर**,*
*Gaurav Daga*
*togauravdaga@gmail.com <to...@gmail.com> | +1.201.308.3242 | Web
Presence <http://goo.gl/lW0nh>  *
Do not follow where the path may lead. Go instead where there is no path
and leave a trail. - Harold R. McAlindon


On Wed, Mar 12, 2014 at 11:39 PM, Lukasz Lenart <lu...@apache.org>wrote:

> No idea what can it be - includeParams="none" is default option for
> sometime
>
> 2014-03-12 23:33 GMT+01:00 Gaurav Daga <to...@gmail.com>:
> > Hello All
> >
> > I am using following construct to generate AJAX endpoint in a portlet
> > application (JSR-286 based).
> >
> > <s:url action="/CaseTaskPortlet/view/ScrollingAction.nextRecords"
> > portletUrlType="resource" id="nextURL" />
> >
> > I have a form field to be carry forward on multiple pages and it started
> > coming as array. While troubleshooting, I noticed that request is
> bringing
> > this value twice. Also in AJAX call from jQuery function I ensured that
> > data getting submitted has only one value.
> >
> > I investigated it further and then I found that generated url, is
> capturing
> > values from the action stack.  And it carry forward old value stack to
> next
> > values. Now I dont want to carry forward these values, what are my
> options?
> >  I tried includeContext="false", and includeParams="none", both didn't
> give
> > me desired results.  Can someone please help me to "not to include values
> > from the old stack"?
> >
> > Here is example of what is happening:
> >
> > *First request execution *
> > [3/12/14 15:16:48:572 PDT] 00000023 SystemOut     O Key :
> > struts.portlet.mode
> > [3/12/14 15:16:48:572 PDT] 00000023 SystemOut     O Value : Values :
> > 0 view
> > [3/12/14 15:16:48:572 PDT] 00000023 SystemOut     O Key :
> selectedOfficeCode
> > [3/12/14 15:16:48:572 PDT] 00000023 SystemOut     O Value : Values :
> > 0 CO
> > [3/12/14 15:16:48:572 PDT] 00000023 SystemOut     O Key :
> > struts.portlet.action
> > [3/12/14 15:16:48:572 PDT] 00000023 SystemOut     O Value : Values :
> > 0
> >
> /CaseTaskPortlet/view/CaseTaskPortlet/view/TaskViewAction.navigateToApplications
> >
> > *Second request execution *
> >
> >
> > 3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O +++++++++++++++++
> > Resource Request +++++++++++++++++++++
> > [3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Key :
> > pagingBean.commandTypeCode
> > [3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Value : Values :
> > 0 taskViewCMD
> > [3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Key :
> > struts.portlet.mode
> > [3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Value : Values :
> > 0 view
> > 1 view
> > [3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Key :
> > pagingBean.pageSize
> > [3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Value : Values :
> > 0 20
> > [3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Key :
> selectedOfficeCode
> > [3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Value : Values :
> > 0 CO
> > 1 CO
> > [3/12/14 15:16:56:556 PDT] 00000023 SystemOut     O Key :
> > struts.portlet.action
> > [3/12/14 15:16:56:556 PDT] 00000023 SystemOut     O Value : Values :
> > 0 /CaseTaskPortlet/view/CaseTaskPortlet/view/ScrollingAction.nextRecords
> > 1
> >
> /CaseTaskPortlet/view/CaseTaskPortlet/view/TaskViewAction.navigateToApplications
> > [3/12/14 15:16:56:556 PDT] 00000023 SystemOut     O Key :
> > pagingBean.officeCode
> > [3/12/14 15:16:56:556 PDT] 00000023 SystemOut     O Value : Values :
> > 0 CO
> >
> >
> >
> > *Thanks & Regards/ **सादर**,*
> > *Gaurav Daga*
> > *togauravdaga@gmail.com <to...@gmail.com> | +1.201.308.3242 | Web
> > Presence <http://goo.gl/lW0nh>  *
> > Do not follow where the path may lead. Go instead where there is no path
> > and leave a trail. - Harold R. McAlindon
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>

Re: Struts2 URL generation for Portlet AJAX

Posted by Lukasz Lenart <lu...@apache.org>.
No idea what can it be - includeParams="none" is default option for sometime

2014-03-12 23:33 GMT+01:00 Gaurav Daga <to...@gmail.com>:
> Hello All
>
> I am using following construct to generate AJAX endpoint in a portlet
> application (JSR-286 based).
>
> <s:url action="/CaseTaskPortlet/view/ScrollingAction.nextRecords"
> portletUrlType="resource" id="nextURL" />
>
> I have a form field to be carry forward on multiple pages and it started
> coming as array. While troubleshooting, I noticed that request is bringing
> this value twice. Also in AJAX call from jQuery function I ensured that
> data getting submitted has only one value.
>
> I investigated it further and then I found that generated url, is capturing
> values from the action stack.  And it carry forward old value stack to next
> values. Now I dont want to carry forward these values, what are my options?
>  I tried includeContext="false", and includeParams="none", both didn't give
> me desired results.  Can someone please help me to "not to include values
> from the old stack"?
>
> Here is example of what is happening:
>
> *First request execution *
> [3/12/14 15:16:48:572 PDT] 00000023 SystemOut     O Key :
> struts.portlet.mode
> [3/12/14 15:16:48:572 PDT] 00000023 SystemOut     O Value : Values :
> 0 view
> [3/12/14 15:16:48:572 PDT] 00000023 SystemOut     O Key : selectedOfficeCode
> [3/12/14 15:16:48:572 PDT] 00000023 SystemOut     O Value : Values :
> 0 CO
> [3/12/14 15:16:48:572 PDT] 00000023 SystemOut     O Key :
> struts.portlet.action
> [3/12/14 15:16:48:572 PDT] 00000023 SystemOut     O Value : Values :
> 0
> /CaseTaskPortlet/view/CaseTaskPortlet/view/TaskViewAction.navigateToApplications
>
> *Second request execution *
>
>
> 3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O +++++++++++++++++
> Resource Request +++++++++++++++++++++
> [3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Key :
> pagingBean.commandTypeCode
> [3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Value : Values :
> 0 taskViewCMD
> [3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Key :
> struts.portlet.mode
> [3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Value : Values :
> 0 view
> 1 view
> [3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Key :
> pagingBean.pageSize
> [3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Value : Values :
> 0 20
> [3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Key : selectedOfficeCode
> [3/12/14 15:16:56:555 PDT] 00000023 SystemOut     O Value : Values :
> 0 CO
> 1 CO
> [3/12/14 15:16:56:556 PDT] 00000023 SystemOut     O Key :
> struts.portlet.action
> [3/12/14 15:16:56:556 PDT] 00000023 SystemOut     O Value : Values :
> 0 /CaseTaskPortlet/view/CaseTaskPortlet/view/ScrollingAction.nextRecords
> 1
> /CaseTaskPortlet/view/CaseTaskPortlet/view/TaskViewAction.navigateToApplications
> [3/12/14 15:16:56:556 PDT] 00000023 SystemOut     O Key :
> pagingBean.officeCode
> [3/12/14 15:16:56:556 PDT] 00000023 SystemOut     O Value : Values :
> 0 CO
>
>
>
> *Thanks & Regards/ **सादर**,*
> *Gaurav Daga*
> *togauravdaga@gmail.com <to...@gmail.com> | +1.201.308.3242 | Web
> Presence <http://goo.gl/lW0nh>  *
> Do not follow where the path may lead. Go instead where there is no path
> and leave a trail. - Harold R. McAlindon

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