cancel
Showing results for 
Search instead for 
Did you mean: 

Passing parameter from JSPDynpage to Webdynpro

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Sigiswald
Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Sigiswald,

Thanks for the detailed description.

But if i use URL parameters, all parameter and values will be visible right?. is there any way to hide?..

due to security issue we dont want to show parameter values. is there any alternative solution?

rEgards ,

SKB

Sigiswald
Contributor
0 Kudos

You're right, all parameters are visible. There's only thing I can recommend in this case: encrypt the parameter value.

Kind regards,

Sigiswald

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Mausam,

In webdynpro iview property : application parameter i kept = * and

Customer Exits for 'ParameterProvider = kept empty.

I am not able to find "Parameters Forwarded to Web Dynpro" where can i find this?.

regards,

SKB

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Mausam,

I am using EP SP13. i created iview using "SAP Web Dynpro iView" template.

I can see only application parameter while creating the iview and i kept * there.

help me out where i am doing wrong?.

regards,

skb

Former Member
0 Kudos

Hi, NWEP

Check out the iView properties. You will find the parameter called "Parameter Forwarded to Web Dynpro".

Regards,

Mausam

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

It's not Web Dynpro property. It's iView property to forward the parameter to Web Dynpro. Please do "Show All" and find the property in the list.

Thanks and Regards,

Mausam

Sigiswald
Contributor
0 Kudos

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