Problem solve Get help with specific problems with your technologies, process and projects.

Problems with JCo in JSP

A reader wonders how to write a JSP file to implement the System.out.println... sentences in the JavaBean.

I've a problem to import the jCO.jar file in my JSP file. I've developed a JavaBean which called a BAPI to connect to the SAP R/3 system. However, I don't know how to write my JSP file to implement the System.out.println... sentences in the JavaBean.

Without having access to your code, I can't offer a definitive answer for you. However, I can give you some tips to get you looking in the right direction.

Make sure you have this statement at the top of your JSP (Java Server Page):

<%@page import="com.sap.mw.jco.*"%> This ensures that you will have access to the libraries contained within jco.jar (or sapjco.jar, if you are using a newer version). Also, make sure that jco.jar is in the CLASSPATH used by your application server. This means that where ever you set the CLASSPATH, whether in your autoexec.bat, sy tem variables, or in the startup of your application server, part of that path must look like this:


Finally, if you are storing data in a JavaBean that must be displayed in your JSP, use get/set methods in the JavaBean to retrieve that data. A 'System.out.println' in your JavaBean will not display in your JSP, as these statements are caught by the Java Virtual Machine and displayed in the JVM's command console window. Use a statement such as:

<%= myJavaBean.getSomeInfo() %>

To display text within your Java Server Page.

Dig Deeper on SAP Java and J2EE

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.