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
Related Q&A from Austin Sincock
How to provide an SAP R/3 4.5B application server with a Web service interface Continue Reading
A reader wants to know how to consume a Web service from an SAP 4.6c R/3 application server. Continue Reading
Are you a Java/J2EE developer interested in SAP? This expert tip lists the most relevant SAP modules and technologies for you. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.