关于用Jbuilder9编译程序以及用weblogic8.1发布Serverlet的问题
1.首先是Jbuilder9没有集成J2EE的类(比如:javax.servlet.http.HttpServlet)所以在编译下面这个简单的程序时报错,程序为:
import javax.servlet.http.HttpServlet;
import
javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import
java.io.IOException;
import java.io.PrintWriter;
public class ServletDemo extends HttpServlet{
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws
IOException,
ServletException {
response.setContentType( "text/html;charset=GB2312 ");
PrintWriter out=response.getWriter();
out.println( " <html> ");
out.println( " <head> ");
out.println( " <title> Hello World! </title> ");
out.println( " </head> ");
out.println( " <body> ");
out.println( " <h1> Hello!这是服务器小应用程序ServletDemo的输出! </h1> ");
out.println( " </body> ");
out.println( " </html> ");
}
}
报错是:ServletDemo of class ServletDemo(src) failed to load superclass HttpServlet
于是我按照网上查的解决方法:在JB的configure servers里面配好了weblogic8.1,可是编译仍然没有通过。其实,我觉得也没道理通过,因为weblogic自带的jdk里面同样没有j2ee的类啊。
而我安装j2ee sdk然后设好环境变量,再到dos下用命令却可以通过编译。所以我想问一下Jbuilder如果要用来编serverlet的东西的话,究竟该怎么配置?
2.其次是weblogic上发布web应用程序,发布成功,用浏览器访问,却报错的问题:
我把ServletDemo打包为:ServletDemo.war,其中包括:
WEB-INF(文件夹)-web.xml,weblogic.xml,classes(文件夹)-ServletDemo.class
web.xml的内容为:
<?xml version= "1.0 " encoding= "ISO-8859-1 "?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN " "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd ">
<web-app>
<servlet>
<servlet-name> ServletDemo </servlet-name>
<servlet-class> ServletDemo </servlet-class>
</servlet>
<servlet-mapping>
<servlet-name> ServletDemo </servlet-name>
<url-pattern> /ServletDemo/* </url-pattern>
</servlet-mapping>
</web-app>
weblogic.xml的内容为:
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 6.0//EN " "http://www.beasys.com/j2ee/dtds/weblogic-web-jar.dtd ">
<weblogic-web-app>
<charset-params>
&