Servlet的存放位置?

zhonggeng 2003-02-27 03:38:08
JSP文件:
<html>
<head>
<title>
jsp1
</title>
</head>
<body bgcolor="#ffffff">
<form name="subForm" method="post" action="Servlet1">
<b>UserName:</b><input type="text" name="userName"><br>
<B>PassWord:</b><input type="text" name="passWord"><br>
<input type="submit" name="sub" value="submit">
</form>
</body>
</html>
///////////////////////
Servlet1文件:
package test;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

public class Servlet1 extends HttpServlet {
private static final String CONTENT_TYPE = "text/html";
//Initialize global variables
public void init() throws ServletException {
}
//Process the HTTP Post request
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
Enumeration e=request.getParameterNames();
while(e.hasMoreElements()){
String name=(String)e.nextElement();
String value=request.getParameter(name);
out.print(name+"=="+value);
}
}
//Clean up resources
public void destroy() {
}
}
Servlet1应该存放在哪里?
...全文
242 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
huatu122 2003-02-27
  • 打赏
  • 举报
回复
大部在WEB-INF目录下编译。用javac servlet.java编译
light_swing 2003-02-27
  • 打赏
  • 举报
回复
在CLASSES中!!
gjd111686 2003-02-27
  • 打赏
  • 举报
回复
提供Http服务的程序叫Web服务器
gjd111686 2003-02-27
  • 打赏
  • 举报
回复
在你的Web程序文件夹中建立Web_INF文件夹再建立class文件夹中
mg999 2003-02-27
  • 打赏
  • 举报
回复
用什么做web服务器?

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧