在ASP中使用Java类(Using Java Classes from ASP)
当前位置:点晴教程→知识管理交流
→『 技术文档交流 』
[p]using java classes from asp[/p]
[p]com components aren't the only way to use compiled code in your asp applications. if you're familiar with [br]java, but have no way of wrapping your classes as com objects (for example, you use jdk or j++ standard), [br]you can still use java from asp. and here's how[/p] [p]first, make sure you have access to the c: [p]next step, compile your java class as you would compile an applet or console class, using your favourite [br]compiler, any one will do, and remember to jot down the names of the public methods and properties your [br]class makes available.[/p] [p]drop your class file into the trustlib folder, and make sure you have a recent java virtual machine [br]installed on the server. the latest ms version is here.[/p] [p]now to call the class from your asp pages, use the following syntax[/p] [p]set myjavaobject = getobject("java:classname")[br]so if you compiled your class as 'foobar.class', you use[/p] [p]set myjavaobject = getobject("java:foobar")[br]generally, the performance of a java class used like this is slightly slower than a com dll, but faster [br]than just scripting, and you also have easy access to the inbuilt java class libraries, some of which [br]you'll find very useful in your asp apps.[/p] [p]finally, call methods of the object as you would call methods of any other com component[/p] [p]happy coding[/p] 该文章在 2010/7/7 23:26:36 编辑过 |
关键字查询
相关文章
正在查询... |