Topic: 关于SERVLET

  Print this page

1.关于SERVLET Copy to clipboard
Posted by: panjiandong
Posted on: 2004-04-16 13:06

package sevlet1;

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; charset=GBK";
/**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();
out.println("<html>");
out.println("<head><title>Servlet1</title></head>");
out.println("<body>");
out.println("<p>The servlet has received a POST. This is the reply.</p>");
Enumeration e=request.getParameterNames();
while(e.hasMoreElements())
{
String name=(String)e.nextElement();
String value=request.getParameter(name);
out.println(name+"==="+value);
}
out.println("</body></html>");
}
/**Clean up resources*/
public void destroy() {
}
}
高手帮我看看是什么错误
谢谢!!!!!

2.Re:关于SERVLET [Re: panjiandong] Copy to clipboard
Posted by: zerol
Posted on: 2004-04-16 15:15

ask smart , please !
同学,信息详细一点!

3.Re:关于SERVLET [Re: panjiandong] Copy to clipboard
Posted by: panjiandong
Posted on: 2004-04-16 17:02

我在DOS
下面运行上面的代码报错有几十外的错误
是不是我的SERVLET
配置有问题的咧???

4.Re:关于SERVLET [Re: panjiandong] Copy to clipboard
Posted by: tiengulden
Posted on: 2004-04-17 15:47

把dos下报的异常贴出来。

5.Re:关于SERVLET [Re: tiengulden] Copy to clipboard
Posted by: nothing
Posted on: 2004-04-17 16:58

servlet 要在tomcat一类的应用服务器上运行

6.Re:关于SERVLET [Re: panjiandong] Copy to clipboard
Posted by: nothing
Posted on: 2004-04-17 17:11



package untitled1;

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; charset=GBK";
/**Initialize global variables*/
public void init() throws ServletException {
}

/**Process the HTTP Post request*/
public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head><title>Servlet1</title></head>");
out.println("<body>");
out.println("<p>The servlet has received a POST. This is the reply.</p>");
Enumeration e = request.getHeaderNames();
while (e.hasMoreElements()) {
String name = (String) e.nextElement();
String value = request.getParameter(name);
out.println(name + "===" + value + "<BR>");
}
out.println("</body></html>");
}

public void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
doGet(request, response);
}


/**Clean up resources*/
public void destroy() {
}
}


7.Re:关于SERVLET [Re: panjiandong] Copy to clipboard
Posted by: panjiandong
Posted on: 2004-04-17 18:24

感谢各位高手!!!!!


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923