那个jsp源码如下
<%--
Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
This software is the proprietary information of Sun Microsystems, Inc.
Use is subject to license terms.
--%><%@ page import="Converter,ConverterHome,javax.ejb.*, java.math.*, javax.naming.*, javax.rmi.PortableRemoteObject, java.rmi.RemoteException" %>
<%!
private Converter converter = null; public void jspInit() {
try {
InitialContext ic = new InitialContext();
Object objRef = ic.lookup("java:comp/env/ejb/TheConverter");
ConverterHome home = (ConverterHome)PortableRemoteObject.narrow(objRef, ConverterHome.class);
converter = home.create();
} catch (RemoteException ex) {
System.out.println("Couldn't create converter bean."+ ex.getMessage());
} catch (CreateException ex) {
System.out.println("Couldn't create converter bean."+ ex.getMessage());
} catch (NamingException ex) {
System.out.println("Unable to lookup home: "+ "TheConverter "+ ex.getMessage());
}
} public void jspDestroy() {
converter = null;
}
%>
<html>
<head>
<title>Converter</title>
</head><body bgcolor="white">
<h1><b><center>Converter</center></b></h1>
<hr>
<p>Enter an amount to convert:</p>
<form method="get">
<input type="text" name="amount" size="25">
<br>
<p>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form><%
String amount = request.getParameter("amount");
if ( amount != null && amount.length() > 0 ) {
BigDecimal d = new BigDecimal (amount);
%>
<p>
<%= amount %> dollars are <%= converter.dollarToYen(d) %> Yen.
<p>
<%= amount %> Yen are <%= converter.yenToEuro(d) %> Euro.
<%
}
%></body>
</html>
<%--
Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
This software is the proprietary information of Sun Microsystems, Inc.
Use is subject to license terms.
--%><%@ page import="Converter,ConverterHome,javax.ejb.*, java.math.*, javax.naming.*, javax.rmi.PortableRemoteObject, java.rmi.RemoteException" %>
<%!
private Converter converter = null; public void jspInit() {
try {
InitialContext ic = new InitialContext();
Object objRef = ic.lookup("java:comp/env/ejb/TheConverter");
ConverterHome home = (ConverterHome)PortableRemoteObject.narrow(objRef, ConverterHome.class);
converter = home.create();
} catch (RemoteException ex) {
System.out.println("Couldn't create converter bean."+ ex.getMessage());
} catch (CreateException ex) {
System.out.println("Couldn't create converter bean."+ ex.getMessage());
} catch (NamingException ex) {
System.out.println("Unable to lookup home: "+ "TheConverter "+ ex.getMessage());
}
} public void jspDestroy() {
converter = null;
}
%>
<html>
<head>
<title>Converter</title>
</head><body bgcolor="white">
<h1><b><center>Converter</center></b></h1>
<hr>
<p>Enter an amount to convert:</p>
<form method="get">
<input type="text" name="amount" size="25">
<br>
<p>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form><%
String amount = request.getParameter("amount");
if ( amount != null && amount.length() > 0 ) {
BigDecimal d = new BigDecimal (amount);
%>
<p>
<%= amount %> dollars are <%= converter.dollarToYen(d) %> Yen.
<p>
<%= amount %> Yen are <%= converter.yenToEuro(d) %> Euro.
<%
}
%></body>
</html>
解决方案 »
- JPA的@Table与Hibernate自己的@Table的关系
- list 清除指定对象
- Struts 属性文件里我想保存标签的名称,但是里面包含符号,不让保存,有什么办法?
- Java打包问题?
- 有关JDBC在WINDOW SERVER 2003中的问题
- web服务器:tomcat,数据库:sql server 用户登录时间不能满足要求,根本问题在那里呢??
- Applet访问资源(读写文件)数字签名,求助!!
- Weblogic建MS SQLServer 2000连接的问题.
- 本人有一套ejb产品(想与大家资源共享)
- 用applet做的corba客户端,使用appletviewer运行可以连接服务器,但在ie中却不行????
- 50分求解 axis中java控制台的原因..http://localhost:8080/axis/SOAPMonitor
- [求助]Apache2与Tomcat4的整合问题? 急!
<%--
Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
This software is the proprietary information of Sun Microsystems, Inc.
Use is subject to license terms.
--%><%@ page import="Converter,ConverterHome,javax.ejb.*, java.math.*, javax.naming.*, javax.rmi.PortableRemoteObject, java.rmi.RemoteException" %>
<%!
private Converter converter = null; public void jspInit() {
try {
InitialContext ic = new InitialContext();
Object objRef = ic.lookup("java:comp/env/ejb/TheConverter");
ConverterHome home = (ConverterHome)PortableRemoteObject.narrow(objRef, ConverterHome.class);
converter = home.create();
} catch (RemoteException ex) {
System.out.println("Couldn't create converter bean."+ ex.getMessage());
} catch (CreateException ex) {
System.out.println("Couldn't create converter bean."+ ex.getMessage());
} catch (NamingException ex) {
System.out.println("Unable to lookup home: "+ "TheConverter "+ ex.getMessage());
}
} public void jspDestroy() {
converter = null;
}
%>
<html>
<head>
<title>Converter</title>
</head><body bgcolor="white">
<h1><b><center>Converter</center></b></h1>
<hr>
<p>Enter an amount to convert:</p>
<form method="get">
<input type="text" name="amount" size="25">
<br>
<p>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form><%
String amount = request.getParameter("amount");
if ( amount != null && amount.length() > 0 ) {
BigDecimal d = new BigDecimal (amount);
%>
<p>
<%= amount %> dollars are <%= converter.dollarToYen(d) %> Yen.
<p>
<%= amount %> Yen are <%= converter.yenToEuro(d) %> Euro.
<%
}
%></body>
</html>
<%--
Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
This software is the proprietary information of Sun Microsystems, Inc.
Use is subject to license terms.
--%><%@ page import="Converter,ConverterHome,javax.ejb.*, java.math.*, javax.naming.*, javax.rmi.PortableRemoteObject, java.rmi.RemoteException" %>
<%!
private Converter converter = null; public void jspInit() {
try {
InitialContext ic = new InitialContext();
Object objRef = ic.lookup("java:comp/env/ejb/TheConverter");
ConverterHome home = (ConverterHome)PortableRemoteObject.narrow(objRef, ConverterHome.class);
converter = home.create();
} catch (RemoteException ex) {
System.out.println("Couldn't create converter bean."+ ex.getMessage());
} catch (CreateException ex) {
System.out.println("Couldn't create converter bean."+ ex.getMessage());
} catch (NamingException ex) {
System.out.println("Unable to lookup home: "+ "TheConverter "+ ex.getMessage());
}
} public void jspDestroy() {
converter = null;
}
%>
<html>
<head>
<title>Converter</title>
</head><body bgcolor="white">
<h1><b><center>Converter</center></b></h1>
<hr>
<p>Enter an amount to convert:</p>
<form method="get">
<input type="text" name="amount" size="25">
<br>
<p>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form><%
String amount = request.getParameter("amount");
if ( amount != null && amount.length() > 0 ) {
BigDecimal d = new BigDecimal (amount);
%>
<p>
<%= amount %> dollars are <%= converter.dollarToYen(d) %> Yen.
<p>
<%= amount %> Yen are <%= converter.yenToEuro(d) %> Euro.
<%
}
%></body>
</html>