jsp+servlet的问题
我用的是eclipse3.0.1+tomcat5+lomboz3.0,我写了一个index.jsp和一个servlet:
我在jsp中使submit提交到servlet上去,可是我的页面刚打开就打不开。
不知道是不是配置有问题,代码如下:
jsp如下:
<!-- Copyright (c) 2002 by ObjectLearn. All Rights Reserved. -->
<html>
<head>
<title>FormGetExample</title>
</head>
<body background="#FFFFF">
<form name="form" method="get" action="http://localhost:8080/servlet/FormGetExample1">
<table width="261" height="30">
<tr>
<td width="109" height="10">姓名:</td>
<td width="276" height="10">
<input type="text" name="nickname">
</td>
</tr>
<tr>
<td width="109" height="8">密码:</td>
<td width="276" height="4">
<input type="password" name="pssword1" value="">
</td>
</tr>
</table>
<p align="center">
<input type="submit" name="submit" value="确定">
<input type="submit" name="submit" value="重来">
</p>
</form>
</body>
</html>
servlet如下:
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class FormGetExample1 extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws
ServletException,
IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out .println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>Servlet Get Example</TITLE></HEAD>");
out.println(" <BODY>");
out.print("<p> </p>");
out.print("<p><font size='+4'>"+"Servlet Get Example"+"</font></p>");
Enumeration Enumeration = request.getParameterNames();
while(Enumeration.hasMoreElements())
{
String key = (String)Enumeration.nextElement();
String value = request.getParameter(key);
out.print("<P>");
out.print(key+"="+value);
out.print("</P>");
}
out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
}
}
web.xml如下:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Copyright (c) 2002 by ObjectLearn. All Rights Reserved. -->
<web-app>
<servlet>
<servlet-name>FormGetExample1</servlet-name>
<display-name>FormGetExample1</display-name>
<description>FormGetExample1</description>
<servlet-class>FormGetExample1</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>FormGetExample1</servlet-name>
<url-pattern>FormGetExample1</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcom