learn for code
<%@ page import="jade.core.*" %> <jsp:useBean id="oldsnooper" class="examples.jsp.Snooper" scope="application"> <% try { // Does not work for the moment // JADE 1.4 String args = {"-platform", "buffer:examples.jsp.Buffer"}; String args = {"-container"}; jade.Boot.main(args); System.out.println("Jade Inited()"); System.out.println("Start"); oldsnooper.doStart("oldsnooper"); } catch (Exception ex) { out.println(ex); } %> </jsp:useBean>
<% oldsnooper.snoop(request.getRemoteHost()+" "+(new java.util.Date())+" "+request.getRequestURI()); %>
jade启动的方式原来还有jade.Boot.main受教了。把参数放在args里,就像是在用命令行一样。 String args2 = { "-gui" }; jade.Boot.main(args2); Runtime rt = Runtime.instance(); Profile pMain = new ProfileImpl(null, 5689, null); AgentContainer mc = rt.createMainContainer(pMain); rt.setCloseVM(false); try { AgentController rma = mc.createNewAgent("rma", "jade.tools.rma.rma", new Object); rma.start();
} catch (StaleProxyException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}