日期:2014-05-17  浏览次数:20926 次

jsp与servlet之间参数传递出现问题。jsp提交后无响应··
以下是index.jsp的内容
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>张旭,servlet练习程序</title>
</head>
<body>
<table width="778" border="0"> 
<tr> 
<td>
<P>请你输入一个年份以查询是否为闰年!</P>
<form method="post">
<input type="text" name="text1">
<input type="submit" value="查询">
</form>
</td> 
</tr>
</table> 
</body>
</html>
——————————————————————————————————————————————————————
以下是Chuli.java的内容
package com;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
 * Servlet implementation class Chuli01
 */
@WebServlet("/Chuli01")
public class Chuli01 extends HttpServlet {
private static final long serialVersionUID = 1L;
   
  /**
  * @see HttpServlet#HttpServlet()
  */
  public Chuli01() {
  super();
  // TODO Auto-generated constructor stub
  }

/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
super.doPost(request, response);
}

/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


response.setContentType("text/html");
  PrintWriter out = response.getWriter();

  HttpSession session = request.getSession(true);
String number = request.getParameter("text1"); //在文本域中获得数值
int runnian = Integer.parseInt(number); //将树枝变成整数
if(1000<runnian&&runnian<9999){ //判断数值是否在一般范围内
if(runnian/100==0){ //判断该年份是否为世纪年
if(runnian/4==0){
response.sendRedirect("runnian.jsp");
}else{
response.sendRedirect("pingnian.jsp");
}
}else if(runnian/4==0){ //是否为平年
response.sendRedirect("runnian.jsp");
}else{
response.sendRedirect("pingnian.jsp");
}
}else{
response.sendRedirect("error.jsp");
}
}

}
——————————————————————————————————————————————————————
以下是我的web.xml内容

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements. See the NOTICE file distributed with