一..在server/default/deploy下创建test.war文件夹
在test.war 下建WEB-INF文件夹
在WEB-INF下建classes文件夹和web.xml
二、运行
在C:\jboss-3.2.1_tomcat-4.1.24\bin下点击run.bat运行。
测试方法如下:
http://localhost:8080/jmx-console
看到jmx agent view
表示成功
三.servlet的测试
(1)测试程序:helloworld.java
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class helloworld extends HttpServlet
{
public void doGet(HttpServletRequest request,HttpServletResponse response)throws IOException,ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("
");out.println("This is my first Servlet");
out.println("
");out.println("
Hello,World!
");out.println("");
}
}
编译
javac helloworld.java
java helloworld
将生成的helloworld.class文件放在classes目录下。
(2)
配置web.xml文件如下:
web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
helloworld
helloworld
helloworld
/helloworld
(3) 通过调用http://localhost:8080/test/helloworld就可以看到hello world的输出!