Итак:
Java
Code:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication1;
import javax.swing.JApplet;
import javax.swing.JTextPane;
import java.awt.Graphics;
import com.sap.mw.jco.*;
/**
*
* @author vvvictor
*/
public class NewJApplet extends JApplet {
/**
* Initialization method that will be called after the applet is loaded
* into the browser.
*/
@Override
public void init() {
// TODO start asynchronous download of heavy resources
tp = new JTextPane();
tp.setSize(getContentPane().getSize());
getContentPane().add(tp);
}
@Override
public void paint(Graphics g) {
JCO.Client client = null;
client = JCO.createClient("мандант", "юзверь", "пароль", "RU", "сервер", "номер системы");
client.connect();
JCO.Attributes attributes = client.getAttributes();
tp.setText(attributes.toString());
client.disconnect();
}
// TODO overwrite start(), stop() and destroy() methods
private JTextPane tp;
}
HTML(честно перепаханный с платингуевского чтоб не париться)
Code:
<html><head>
<title>Applet</title></head>
<body>
<SCRIPT language="JavaScript">
// user configurable part starts here
var pluginurl = '';
var scriptable = 'false';
var codebase = '.';
// user configurable part ends here
// verify if Java Plugin as control in Internet Explorer or Java Plugin for Mozilla or native JRE of browser must be used
var jre = 'control';
if(navigator.platform.indexOf("Mac") > -1) jre = 'native';
else if (navigator.appName.indexOf("Netscape") != -1) jre = 'plugin';
document.open();
switch (jre)
{
// code for Internet Explorer
case 'control':
document.writeln('<OBJECT CLASSID = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"');
document.writeln(' ID = "Test"');
document.writeln(' WIDTH = "100%"');
document.writeln(' HEIGHT = "100%"');
document.writeln(' BORDER = 0>');
document.writeln('<PARAM NAME = "TYPE" VALUE = "application/x-java-applet;version=1.5">');
document.writeln('<PARAM NAME = "code" VALUE = "javaapplication1.NewJApplet">');
document.writeln('<PARAM NAME = "codebase" VALUE = "', codebase,'">');
document.writeln('<PARAM NAME = "archive" VALUE = "JavaApplication1.jar,sapjco.jar">');
document.writeln('');
document.writeln('This page requires a Sun Java Plugin 1.5 and a SAPGUI for Java to view.');
document.writeln('');
document.writeln('</OBJECT>');
break;
// code for Mozilla
case 'plugin':
document.writeln('<EMBED TYPE = "application/x-java-applet;version=1.5"');
document.writeln(' PLUGINURL = "', pluginurl,'"');
document.writeln(' WIDTH = "100%"');
document.writeln(' HEIGHT = "100%"');
document.writeln(' ALIGN = "BASELINE"');
document.writeln(' code = "javaapplication1.NewJApplet"');
document.writeln(' codebase = "."');
document.writeln(' archive = "JavaApplication1.jar,sapjco.jar"');
document.writeln(' <NOEMBED>');
document.writeln('');
document.writeln(' This page requires a Sun Java Plugin 1.5 and a SAPGUI for Java to view.');
document.writeln('');
document.writeln(' </NOEMBED>');
document.writeln(' </EMBED>');
break;
// code for Internet Explorer without Java Plugin
case 'native':
document.writeln('<APPLET CODEBASE = "', codebase,'"');
document.writeln(' ARCHIVE = "JavaApplication1.jar,sapjco.jar"');
document.writeln(' CODE = "javaapplication1.NewJApplet"');
document.writeln(' WIDTH = "100%"');
document.writeln(' HEIGHT = "100%">');
document.writeln('');
document.writeln('This page requires a Java Runtime 1.5 and a SAPGUI for Java to view.');
document.writeln('</APPLET>');
break;
}
document.close();
</SCRIPT>
</body>
</html>
Обработав сообщения об ошибках добавил в C:\Program Files\Java\jre6\lib\security\java.policy
Code:
permission java.util.PropertyPermission "jco.middleware_library", "read";
permission java.lang.RuntimePermission "loadLibrary.sapjcorfc";
permission java.util.PropertyPermission "java.library.path", "read";
permission java.util.PropertyPermission "jco.trace_level", "read";
permission java.util.PropertyPermission "jco.jdsr", "read";
permission java.util.PropertyPermission "jco.jarm", "read";
Для упрощения ситуации закинул в C:\Program Files\Java\jre6\bin нужные dll-ки.
HTML и JAR-ки кинул в каталог вебсервера и все работает....
_________________
Ex ipso fonte bibere
Цитата:
Abyssus abyssum invocat
Dies diem docet
Ducunt volentem fata, nolentem trahunt
Estote prudentes sicut serpentes