<%@ 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("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());
}
} 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>
解决方案 »
- hibernate如何用annotation设置树形结构
- 求各位大侠帮我看看,输出数组中最大的,
- 【求助】jsp页面连接数据库失败
- Apache DS 存放xml信息
- java+mysql程序打包发布
- actionform的小问题
- Weblogic狂吃内存问题,急!!!!
- 提供参考指南(急)
- 本人已經寫好了一個BEAN管理的實體BEAN,但不知怎樣在WEBLOGIC中配置(每次部署都出錯,可能是數據庫部分沒有配好)?????
- java中使用getResourceAsStream()能不能识别绝对路径
- 在J2EE服务器里部署EJB的时候出现如下错误,什么原因呢?
- 请问一个ejb和jsp分开布置的问题
上的Session Bean的例子,请写一个调用该ejb的JSP文件,谢谢!!!