on 02-28-2007 12:01 PM
Hi,
I am trying to get parameter in webdynpro application from JSPdynpage and i have pasted my code snippet.
JSPDynpage Code:
EPCM.doNavigate('My Targett URL');
IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
request.getServletRequest().getSession().setAttribute("PNUMBER", "10001");
In webdynpro:
HttpServletRequest request = ((IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter()).getHttpServletRequest();
HttpSession session = request.getSession();
pNumber = (String)session.getAttribute("PNUMBER");
From JSPDynpage it navigating to webdynpro application but getparameter() always null.
I cross checked both JSPdynpage and webdynpro session getId() both are returning same id but parameter is not passing.
where i am doing wrong?
thanks in advance,
regards,
SKB
Hi SKB,
The problem is that portal applications and Web Dynpro applications have different sessions (even if they have the same session ID). All portal applications are technically one J2EE application (called "sap.com/irj") and all Web Dynpro applications are technically one J2EE application (called "sap.com/tcwddispwda"). The reason why sessions must be different, is because of the J2EE specs. Below is an extract from the Java Servlet Specification 2.4.
<u>SRV.7.3 Session Scope</u>
<i>HttpSession objects must be scoped at the application (or servlet context) level.
The underlying mechanism, such as the cookie used to establish the session, can be the same for different contexts, but the object referenced, including the attributes in that object, must never be shared between contexts by the container.
To illustrate this requirement with an example: if a servlet uses the RequestDispatcher to call a servlet in another Web application, any sessions created for and visible to the servlet being called must be different from those visible to the calling servlet.</i>
The solution to your problem is not to use session attributes, but URL parameters. In your JSPDynpage use something like this
EPCM.doNavigate('ROLES://portal_content/foo&DynamicParameter=PNUMBER%3D10001');
And in your Web Dynpro application use something like this
String pNumber = WDWebContextAdapter.getWebContextAdapter().getRequestParameter("PNUMBER");
Kind regards,
Sigiswald
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi sigiswald,
I am trying to do passing parameter from jspdynpage to webdynpro.
when i pass parameter using pcd location of webdynpro iview always getting null value.
this is the code:
EPCM.doNavigate("ROLES://portal_content/foo&DynamicParameter=PNUMBER%3D10001");
but when i pass parameter on webdynpro application url i am getting the parameter perfect.
http://servername:50000/webdynpro/dispatcher/sample.com/ephr/ApplicationDisplay?PNUMBER=10002
How can i set parameter to PCD Location of the iview using donavigate?
Kindly help me out in this.
regards,
skb
Hi NWEP.
There is a property in the Web Dynpro iView called "Parameters Forwarded to Web Dynpro". You can write in your parameters there like in your case it's "PNUMBER". This will pass the parameter to your WD application and in Web Dynpro application you can get the same by WDWebContextAdapter.
Hope this helps.
Regards,
Mausam
Hi,
I just checked, if you are using EP7 and you are creating your Web Dynpro iView by selecting Web Dynpro type iView from the "create new iView from Web Dynpro application" , this parameter doesnt come. But if you create an iView by going into "iView Templates" and "SAP Web Dynpro iView", you will get this parameter. We used to do this way in EP6.
I'm not sure how to do that with the newer version of Web Dynpro iView.
Thanks and Regards,
Mausam
Hi Mausam,
Under Property Category: Content - Web Dynpro.
I see only following properties:
Application Name
Application Parameters = * (i kept )
Customer Exits for 'ParameterProvider'
Namespace
Show Debug Screen
Stylesheet
Supply Portal Stylesheet
System
Web Dynpro Definition Type
I am not able to find "Parameter Forwarded to Web Dynpro"...I am using EP13
what could be the reason?
regards, skb
Hi NWEP,
I really don't know what you do differently as we do. BTW, we use this on NW04 SP18. I just checked our code and the jsp looks like this:
<%
String paramA = URLEncoder.encode("valueA", "UTF-8");
String paramB = URLEncoder.encode("valueB", "UTF-8");
%>
<script>
EPCM.relaxDocumentDomain();
EPCM.doNavigate('ROLES://portal_content/nl.sap.minvenw.minvenw/rws/pages/overige/registreren&DynamicParameter=paramA%3D<%=paramA%>%26paramB%3D<%=paramB%>');
</script>
Maybe a few details to mention that likely don't matter:
a) we navigate to a page, not directly to an iView
b) we call relaxDocumentDomain before doNavigate
c) we URL encode the parameter values
d) we use doNavigate('foo'); [single quotes; instead of doNavigate("foo");]
Apart from this, there's no extra configuration, not on the portal application and not on the WebDynpro.
Kind regards,
Sigiswald
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.