Re: wpsURLGeneration - Pass JavaScript values using wps:urlParam ? - Websphere
This is a discussion on Re: wpsURLGeneration - Pass JavaScript values using wps:urlParam ? - Websphere ; Hi Jim,
Thanks for you reply. I looked at the Advanced URL generation API's.
Just for test purpose to make sure that my environment is fine, I used the and targeted a second portlet and it called the second portlet ...
-
Re: wpsURLGeneration - Pass JavaScript values using wps:urlParam ?
Hi Jim,
Thanks for you reply. I looked at the Advanced URL generation API's.
Just for test purpose to make sure that my environment is fine, I used the and targeted a second portlet and it called the second portlet when i submit my JSP page on the first portet. I can see the Paramaeter that are included in the been passed to the second portlet. (I have already given a unique name for the portlet window through XML access and thats how i was able to target to the processAction method)..
Now coming to the actual piece of work that i need to implement in the my application i need to pass the client side Request variables from the JSP page to the target Portlet and was looking at the "OffLineURLHelper", but i could not get it working its working. When i click the "submit" button in the first JSP page, i can see the control going to the "second" page, but i could not see the "portlet" in it. And when i click the "Welcome" page its again asking me to authenticate again?
But when i use the wps:URLGeneration tag wit the same "Page Unique name" and "Portlet Unique name" i could see the control going to the second page and my ProcessAction method is also getting called ?
Which API should i use in my situation where my main goal is to pass the "client side" hidden parameters to the "second page" ? (Firs page and second page are two different portlets)
Thanks,
Dinesh
-
Re: wpsURLGeneration - Pass JavaScript values using wps:urlParam ?
use either the servleturlhelper or the portleturlhelper classes the offlineurlhelper cannot target an action phase
IBM Certified System Administrator -- WebSphere Portal V6.0, V5.1, V5.0
IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0
The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM
-
Re: wpsURLGeneration - Pass JavaScript values using wps:urlParam ?
I'm tring to use PortletURLHelper.generateUrl() as per the below signature...
*************************************************************************
public static java.lang.String generateUrl(java.lang.String pageName,
java.lang.String portletName,
java.util.HashMap params,
javax.portlet.PortletRequest request,
javax.portlet.PortletResponse response)
throws com.ibm.portal.state.exceptions.StateException,
javax.naming.NamingException,
java.io.IOException
*************************************************************************
String targetURLStr = PortletURLHelper.generateUrl("6_B4QB7GN30O0PF02BVLQTO42000","jsr.target.called2",map,request,response);
But i get a compile errror as below in my JSP server at runtime
...cannot resolve symbolsymbol : method generateUrl (java.lang.String,java.lang.String,java.util.HashMap,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
My question is the signature of the method accepts javax.portlet.PortletRequest request and javax.portlet.PortletResponse response.
Hence in my implementation i just specified as just request and response as we can see above, but this is interupted as HttpServletRequest and HttpServletResponse by the server.
How can we specify a javax.portlet.PortletRequest and javax.portlet.PortletResponse object in my implementation ?
I know will give the renderRequest and renderResponse to the JSP page
Hence should i just specify renderRequest and renderResponse ??
String targetURLStr = PortletURLHelper.generateUrl("6_B4QB7GN30O0PF02BVLQTO42000","jsr.target.called2",map,renderRequest ,renderResponse ); ??
which should call the actin method of my portlet and pass all the JS variables to my second portlet page ?
-
Re: wpsURLGeneration - Pass JavaScript values using wps:urlParam ?
yes you need to specify the renderresponse and renderrequest
IBM Certified System Administrator -- WebSphere Portal V6.0, V5.1, V5.0
IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0
The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM
-
Re: wpsURLGeneration - Pass JavaScript values using wps:urlParam ?
Hi Jim,
I have tried with both these ways,
"ServletURLHelper.generateUrlToPortlet()" and
"PortletURLHelper.generateUrl()"
but still only the doView() of the second page is only called, the processAction() method is NOT getting called? I Have explictly creatd the portletUniqueName through XMLAccess and imported it back. Hence i'm sure that the PortletID and PageID that i'm using both are coorrect values. My form looks as below..
************************************************************************************************
FORM method="post" action="${target}" name="
************************************************************************************************
//Tried even with PortletURLHelper, but here too the control is going to the doView() method ?
//String targetURLStr = PortletURLHelper.generateUrl("6_B4QB7GN30O0PF02BVLQTO42000","jsr.target.called2",map,renderRequest ,renderResponse );
As you have mentioned PortletURLHelper or ServletURLHelper should take me to the processAction() method ? But not sure why its NOT working in my case? Any other alternative pl ?
Thank You,
Dinesh
-
Re: wpsURLGeneration - Pass JavaScript values using wps:urlParam ?
yes it should target it and I have used it here like that, I would need to see the xmlaccess for the page
as well as the url created
IBM Certified System Administrator -- WebSphere Portal V6.0, V5.1, V5.0
IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0
The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM
-
Re: wpsURLGeneration - Pass JavaScript values using wps:urlParam ?
Hi Jim
Here is the URL that got generated.. Tried to print using the as below
************************U R L************************************************
/wps/myportal/!ut/p/c1/04_SB8K8xLLM9MSSzPy8xBz9CP0os3gnk0Anc3c_YwN3jxBDAyOnMGMXH4tQAwN3M6B8JJK8gaMZSN7J2y_M19fYwN-EGN1-_kahbiaehoYWZq5AeTMPEyefME8DdxdjYnQb4ACOBgR0h4P8it_tIHl8rgPJ47HfzyM_N1W_IDc0NMIgMyDdUVERABUMMsA!/dl2/d1/L0lJSkNTSUpKL0lGakFBQXlBQktqQUlrUm0vWUJwd3hKRjQxMC13LzZfQjRRQjdHTjMwTzBQRjAyQlZMUVRPNDIwMDAvN19CNFFCN0dOMzBHSFQxMDJCVjNETDhVMDA4Mw!!
************************U R L************************************************
Here with i'm attaching the pageExport.xml for my "second page" (target portlet)
Thank You for all your great help..
Dinesh
-
Re: wpsURLGeneration - Pass JavaScript values using wps:urlParam ?
I looked at this and noticed you are on 6000, you may want to upgrade to a later version, there was a problem with urls on public pages that could cause issues.(specifically causing actions to be invalidated), the url looks to be targeting the page correctly, just no action id is created.
Jim
IBM Certified System Administrator -- WebSphere Portal V6.0, V5.1, V5.0
IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0
The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM
-
Re: wpsURLGeneration - Pass JavaScript values using wps:urlParam ?
Hi Jim,
Thanks for looking into the XML file. At this point i'm not sure if its feasible to upgade in our production environment, since this WPS environment is shared by few other portal applications which are usig version 6.0.0.
Mean while we are tring to do some workaround with wps:URLGeneration tag itself, we are trying out options like below.. ie. build the query/string dynamically. In our case when the user clicks SUBMIT we need to collect the client side JS variables and send them as params using the output of tag itself targeting the ActionURL of the second page/portlet..
a href=" CLICK HERE TO SUBMIT
function savePage(url){
//Search for # from the last of the above URL
var lind = url.lastIndexOf('#')
//Strip till # character
var slind = url.substring(0,lind);
//Take Object ID - After #
var afterHash = url.substring(lind,url.length);
//Append our client side JS parameters and make the URL again
slind = slind + "&mykey=myvalue" +afterHash;
location.href = slind;
}
By doing this we can see the params being passed to the processAction() method of the second page. The question is, i belive there will be no harm in manipulating the URL and embeding our own query string dynamiclly like the above one and then pass on to the ActionURL? Do you see any constraints for the URL manipulation by the above approach? Also we might expose the second page/portlet as a WSRP consumer at a later point of time?
Thanks You
Dinesh
-
Re: wpsURLGeneration - Pass JavaScript values using wps:urlParam ?
I would still do the same thing and make the url the target of a form, and submit that form after updating any of the hidden variables.
IBM Certified System Administrator -- WebSphere Portal V6.0, V5.1, V5.0
IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0
The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM