tomcat4.1如何运行

来源:百度知道 编辑:UC知道 时间:2024/05/22 11:29:51
我的装好了,也进行了相关的设置,可以显示http://localhost:8080/index.jsp
我们老师给了我们好多那中class文件,叫我们运行,可是我的机子上弄不出来
说是把HelloWorld.class文件放到D:\Apache Group\Tomcat 4.1\webapps\ROOT\WEB-INF\classes
然后直接http://localhost:8080/servlets/HelloWorld就可以运行
可是我的不可以,想请教一下应该怎么解决啊?
不是你说的这样的,就是那样可以直接运行的。
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("<html>");
out.println("<head>&

你要编写一个applet小程序才能调用class文件:
如下保存为helloworld.html,然后就能用上面的地址打开了。
<html>
<head>
<title> HelloWorld</title>
</head>
<body>
<hr/>
<applet code = "HelloWorld.class" width = 300 height = 200 >
</applet>
<hr/>
</body>
</html>