cancel
Showing results for 
Search instead for 
Did you mean: 

Servlet Usage on .JSP

Former Member
0 Kudos

Hi,

I set up a webpage with a button calling a .JSP of an MII Project.

Inside this .JSP page I would like to add a SERVLET. I would like this servlet ran a certain Query Template.

I would also like to get the result of the query execution (server-side) and have some value (of the resultset) to be displayed client side.

I tried adding in my .JSP BODY something like this without getting any result:

<SERVLET NAME="TableInputData">

<PARAM NAME="QueryTemplate" VALUE="QueryPath/QueryName">

<PARAM NAME="Content-Type" VALUE="text/xml">

<PARAM NAME="Param.1" VALUE="First">

<PARAM NAME="Param.2" VALUE="Second">

<PARAM NAME="Param.3" VALUE="Third">

<PARAM NAME="Param.4" VALUE="Fourth">

</SERVLET>

Query Template is ok if I test it alone.

I'm not sure if SERVLET is executed server-side and especially how to access query resultset (this could be a way to check about execution)

I also tried with this (I found it somewhere, not fully understanding the meaning):

<SERVLET NAME="Illuminator">

<PARAM NAME="QueryTemplate" VALUE="QueryPath/QueryName">

<PARAM NAME="Server" VALUE="Simulator">

<PARAM NAME="Mode" VALUE="Taglist">

</SERVLET>

Cannot I simply try to execute a MII SQL Query server-side calling my own servlet in .JSP page?

What is correct "Servlet Template" to be used and fundamental parameters?

Best Regards

Accepted Solutions (1)

Accepted Solutions (1)

jcgood25
Active Contributor
0 Kudos

You will need to use IRPT file extensions for the <SERVLET/> sections to work.

Former Member
0 Kudos

Do you mean I'll never be able to have SERVLET working with MII on .JSP pages?

(APPLETs are working in .JSP)

Considering I'll not be allowed to .JSP --> .IRPT, what are other possible solutions to have the effects mentioned above?

Practically to use/call a query template, reading and manipulating resultset inside .JSP?

tnx a lot

Former Member
0 Kudos

Here is a simple example of how to get irpt 'servlet tag' content into a jsp:

<%
 byte[] byteArray = com.sap.xmii.servlet.ServletRunner.run(request, "http://<server>:<port>/XMII/Illuminator?QueryTemplate=<QueryTemplate>&StyleSheet=<StyleSheet>&Session=true");
 String value = new String(byteArray);
 out.println(value);
%>

This is just some curious hackery on my part. Doing something like this is probably NOT supported by SAP.

jcgood25
Active Contributor
0 Kudos

APPLETS in a jsp page (or any other relevant web extension) will work because in a sense they are no different than any other html object, until they get interpreted by the browser and the JRE kicks in. Applets are client-side, and the JRE does the bi-directional communication between the client browser and the MII server.

SERVLET calls like you were attempting are done entirely server side, with the rendered output (typically query results turned into html by an xslt) pushed into the page before it goes to the client browser. A simple way to see this is comparing the raw irpt html source with a browser's view...source after the page renders in the client. You'll see the server side replacement in the text. This is the same effect with resource bundle localization using the {##TOKEN} format, or any for session attributes or URL pass through properties in the Page.irpt?Name=Value format. But for all of the server side activity to work, the IRPT file extension routes the html page through the ReportServlet on the MII side to do all of the work - streaming the results to the client browser.

A JSP page works with the Java App server, like an ASP page works with IIS - the file extension is the key to direct the server to do the work. The IRPT extension happens to be the special one for MII to do the magic server side value-add I mentioned.

To Christian's point about supported/not-supported. JSP pages are of course supported, but at some point you're venturing into a bit more non-traditional so any support ticket processing would run out relatively quickly if you're having all sorts of problems with JSP specific stuff.

An IFRAME calling an IRPT is also another trick that you could use to blend/mix some of the benefits of both IRPT and JSP together.

Answers (0)