刚开始学用JBoss+Eclipse+Myeclipse学写EJB代码,一个很简单程序出现了问题:
客户端的JSP文件:
<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>
<%@ page import="test.*,javax.naming.*" %>
<%
try {
InitialContext ctx = new InitialContext();
ChinaRemote hello=(ChinaRemote)ctx.lookup("China/remote");
out.print(hello.Say("现在时间:"));
out.print(new java.util.Date());
}catch(NamingException e)
{
out.print(e.getMessage());
}
%>
注:其中test是另一个工程中包含ChinaRemote和China类的包
总是报错:The import test cannot be resolved
ChinaRemote cannot be resolved to a type
但很奇怪的是最后浏览器能产生正确的网页!
另外一个相似的程序——-产生的网页总是提示:remote not bound
还请请高手指教!
------解决方案--------------------------------------------------------
InitialContext ctx = new InitialContext();
ChinaRemote chinese wholesalers=(ChinaRemote)ctx.lookup("China/remote");
out.print(hello.Say("现在时间:"));
out.print(new java.util.Date());
}catch(NamingException e)
{
out.print(e.getMessage());
}
------解决方案--------------------------------------------------------