servlet衔接的问题
我在一个包下写了两个servlet:
package talking;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class UserServlet extends HttpServlet {
private static final String CONTENT_TYPE = "text/html; charset=GBK ";
//Initialize global variables
public void init() throws
ServletException {
}
//Process the HTTP Get 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> UserServlet </title> </head> ");
out.println( " <body bgcolor=\ "#ffffff\ " onload= 'javascript:frm.userName.focus '> ");
out.println( " <form method=post action= '/Servlet/mainservlet ' name = 'frm '> ");
out.println( " <center> 请输入你的呢称 </center> ");
out.println( " <center> <input type=text name= 'userName '> ");
out.print( " <input type=submit value= '聊天 '> </center> </form> ");
out.println( " </body> ");
out.println( " </html> ");
out.close();
}
//Process the HTTP Post request
public void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
doGet(request, response);
}
//Clean up resources
public void destroy() {
}
}
package talking;
import javax.servlet.*;
import