cancel
Showing results for 
Search instead for 
Did you mean: 

Call a JSP within a URL

Former Member
0 Kudos

Hello All,

I need to call a JSP File in the mid-process of one Application.

This jsp is called as a hookurl value

i.e it's a Online Purchasing scenario and after the entire purchasing is done then the jsp file is called with an attached hook url to the current url.

So I created a BSP and stored the jsp file as a mime and when i execute the BSP it's working fine but when i put the same path in the " Purchase URL " then it's giving me the following msg :


Business Server Page (BSP) Error

What happened?
Call of BSP page terminated due to error.
   
Note

Following error text processed in system:
BSP exception: Access to URL /sap/bc/bsp/XXXBSPAPPLICATION/Test.jsp is forbidden.
   
Error Type: 

Your SAP Business Server Pages Team

Can anyone tell me whts the error ?

Actually the flow is : One Application is there which when executed will give the output as the same ebay.com. Now the USer needs to purchase some items and at last he'll press one SUbmit button.

When he presses that then the current url will het concatenated to an hookurl with the value as the Path to the JSP.

The path to the jsp is in the MIME of bsp application .

I tried to execute the MIME independently and it's working but when I pass the same to the hookurl the above msg was coming .

Hope I'm clear in explaining my scenario.

Regards,

Deepu.K

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

First of all (as stated earlier), you can't call a jsp page as you would call a html page or something else. A JSP page always needs an JSP container to run (so it needs an Java EE compatible container, like tomcat, ...). So a jsp page would never run within an simple call of a mime repository call within an BSP (-> BSP runs within the ABAP VM, JSP runs within a SUN J2EE Container). From a BSP point of view a jsp is nothing more then an call to an external web application/site (so you have to call it absolute), so you have to call it explicitly (reading resources from the mime repository only means, call local resource). Think of this if you have a bsp app1 which have to call bsp app2 which is hosted on an different server. The principle is the same (no matter if bsp or java).

You posted the jsp-file you got from your customer, but it doesn't do really much! Only reads the request parameters (looks like it's really a test jsp). But no matter, what you really have to find out is:

1. How is the application called (you need the entry point of the application, is the start a java web appl or an abap)

2. Find out the input/output parameters of the application (thats what you need to work with)

3. After that I think you now what do do ... (get parameters from start app -> work with parameters in your bsp -> pass parameters to jsp page -> ... )

Depends your scenario on a WebShop (maybe SAP Standard)?

Regards,

Daniel

Former Member
0 Kudos

Hello Daniel,

1. How is the application called (you need the entry point of the application, is the start a java web appl or an abap)

The application is a ABAP Module Pool Program which contains the url of the supplier shop.

Then the output will be shown using HTMLViewer classes.

2. Find out the input/output parameters of the application (thats what you need to work with)

As told above theinput and output parametes are the URL content.

Now, knowing that the jsp cant work from ABAP I decided to put the jsp in the Portal server.

Then the HOOKUrl will be the path to the jsp file from the Portal server.

Hope this will work but not sure.........am gngto try this !!!

Regards,

Deepu.K

Former Member
0 Kudos

Hello All,

As per your guidance I've put the JSP in the Portal server and gave the server path to the hook url.

( I've created a jsp dynpage for our jsp and deployed it onto the portal. )

Now everything is fine.

Thanks for all the clarifications.

Regards,

Deepu.K

athavanraja
Active Contributor
0 Kudos

what this jsp page is supposed to do? it may not work as expected if not hosted from a java server. you cannot simply put it in your mime repository .

if you are sending a url as a parameter of another url

mypage.htm?hookurl=something/something/page.htm then make sure you encode the hookurl value before passing it to mypage.htm

Former Member
0 Kudos

Hello Raja,

Purpose of JSP : The jsp lists out all the quantities selected by the User and thier prices and other details.

it may not work as expected if not hosted from a java server

How to host that jsp from the Java server ?

How to encode the hookurl value ?

Regards,

Deepu.K

athavanraja
Active Contributor
0 Kudos

The jsp lists out all the quantities selected by the User and thier prices and other details.

from where does the jsp gets these information ?

to escape the hookurl use the following method.

cl_http_utility=>esacape_url

Former Member
0 Kudos

Hello Raja,

from where does the jsp gets these information ?

The code of the jsp is as follows :


<%
  /*
  to test the SAP OCI interface. Make sure that the hook_url in the testSap.html is set to
  this url.
  */
%>

<%
  out.println("<h1>--  SAP OCI TEST START -- </h1>");
  //print parameters
  out.println("<h2>OUTBOUND-SECTION:</h2>");
  java.util.Enumeration enumLogRequest = request.getParameterNames();
  while( enumLogRequest.hasMoreElements() ) 
  {
    String strParm = (String)enumLogRequest.nextElement();
    out.println(strParm + " = " + request.getParameter(strParm) + "<br>");
  }
  out.println("<br><h1>--  SAP OCI TEST END --</h1>");
%>

  • I dont know the exact purpose of escape .

Regards,

Deepu.K

athavanraja
Active Contributor
0 Kudos

are you sure that this jsp stored as a mime in your bsp works fine. BSP runtime cannot understand all those jsp syntax. out.println, etc

Former Member
0 Kudos

Hello Raja,

What I meant saying that it was working means .........my customer expected a blank page when I execute it thru BSP and I too am getting a blank page ...........for which I said it's working.

and coming to the Qn.......

Can u tell me how to make that jsp work ?

Actually the scenario is .......

1. I have a big url ......

eg: www.something.com/something/something&hookurl=(the jsp)

2. when i run this url a page will be displayed wherin i can buy the goods and add them to the cart.

3.now when i press the last button the output will be from the jsp

with the purchased content.

4. My customer said that since the jsp was there with the supplier's server he is not facing any problems but we are facing problems as the jsp is not there in our server ( the problem was when we press the final button a Pur.Requisition(SAP) has to be created which is not being created in this aspect ) .

5. So the idea was to place the jsp on the application server and to include the path of it in the so-called big url.

6. For that reason I created a bsp and included that jsp as a mime .

7. finally I gave the path of it in the bigurl as a value for the hookurl just same as the supplier has .

Hope I'm clear in explaining the back ground of the scenario.

Expect you to throw some light on this !!!!

Regards,

Deepu.k

athavanraja
Active Contributor
0 Kudos

this is what i understand as what you wanted to do.

you have a bsp page which shows something. and onclicking of a button or something in this bsp page you want to call the jsp page which displays some information. you do some action in the jsp page and that should bring you back to your bsp with the info it got from the jsp. is that right?

Former Member
0 Kudos

Hello Raja,

Yes, that's what my intention .But the main program is not a BSP.

Actually it's a Module Pool Program : An Online Catalogue Interface (OCI) for procurement process ,

The program calls the online shop of exclusive vendors and get the basket data at end of online transaction.Form basket data the program creates SAP purchase orders via BAPI .

But one of the parameter of this Interface is the HookURL which shud be given a value.

and the value of that HookUrl is the path of the JSP .

Hope I'm clear now !

Regards,

Deepu.K

athavanraja
Active Contributor
0 Kudos

i think i understand a bit now.

from where did you get the jsp?

in your case i guess you have to pass the whole path (the original path and not the path in your mime repository) of the jsp to hookurl.

Former Member
0 Kudos

Hello Raja,

yes...now u got me.

Thats the reason I originally asked the forum about how to upload a jsp into the application server !

I got a reply saying to use MIMEs.So only I got into BSPs.

Now ,can u tell me how to put this jsp onto the server and get the full path of it ?

Regards,

Deepu.K

athavanraja
Active Contributor
0 Kudos

where did you get this jsp from. its JavaServerPages(jsp) it needs a java engine to execute its codes. you cannot simply use them in your BSP

Former Member
0 Kudos

Hello Raja,

As i told u earlier that this procedure was working fine for our Suppliers (Vendors).

And they said that they have this jsp file on their server.

SO my customer asked the jsp file from them and they sent it to us.

Now we have the jsp file but the problem is : How to put it into the server ?

Regards,

Deepu.K