jsp severl 已经设置了url 为什么还是 进不到Servelt里面呢 大神指点下!!!!!急

qq_41924365 2018-04-23 09:29:17
jsp页面:
<%@ page language="java" import="java.util.*,model.*,entity.*" pageEncoding="utf-8" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<link rel="stylesheet" type="text/css" href="css/register.css">
<link rel="stylesheet" type="text/css" href="css/body.css">
<title>My JSP 'StuEntering.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<jsp:include page="jsp/top.jsp"></jsp:include>
<jsp:include page="jsp/left.jsp"></jsp:include>
<jsp:include page="jsp/fotter.jsp"></jsp:include>

</head>

<body>
<div id="" class="left">
<div id="" class="main" align="left">
<p style="height:20px;"><font style="font-size:30px">所有学生信息</font></p>
<div class="ztable" >
<form action="allStudentServelt" method="post" ><input type="submit" value="查询" class="Denbtn"></form>
<table width="100%" border="1" cellspacing="0" cellpadding="1" align="center" style="text-align:center;font-weight:600;">
<tr>
<td width="100px" height="30px">学号</td>
<td width="80px" height="30px">姓名</td>
<td width="150px" height="30px">学院</td>
<td width="150px" height="30px">班级</td>
<td width="100px" height="30px">出生日期</td>
<td width="100px" height="30px">QQ号码</td>
<td width="100px" height="30px">手机号码</td>
<td width="100px" height="30px">操作</td>
</tr>
<c:forEach var="student" items="${studentlist}" >
<tr>
<td width="100px" height="30px">${student.studentID}</td>
<td width="80px" height="30px">${student.name}</td>
<td width="150px" height="30px">${student.collge}</td>
<td width="150px" height="30px">${student.stuClass}</td>
<td width="100px" height="30px">${student.briday}</td>
<td width="100px" height="30px">${student.QQ}</td>
<td width="100px" height="30px">${student.phone}</td>
<td width="100px" height="30px"><a href="StuUpdateservelt.to? id=${student.studentID}">修改</a><input name="dele" type="submit" value="删除"></td>
</tr>
</c:forEach>

</table>
</div>
</div>
</div>
</body>
</html>


StuUpdateservelt页面:
package Contorl;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import entity.student;
import model.Model;

public class stuUpdateservelt extends HttpServlet {

/**
*
*/
private static final long serialVersionUID = 1L;

/**
* Constructor of the object.
*/


/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}

/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String stuid = request.getParameter("id");
int studentid = Integer.valueOf(stuid);
System.out.println(studentid);
Model model=new Model();
student stud = model.stuinster(studentid);
System.out.println("111");
request.setAttribute("stud", stud);
System.out.println("2");
request.getRequestDispatcher("studentupdate.jsp").forward(request, response);
System.out.println("3");
}

@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// TODO Auto-generated method stub

}

@Override
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
// TODO Auto-generated method stub

}

/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// TODO Auto-generated method stub

}

}


<servlet-mapping>
<servlet-name>stuUpdateservelt</servlet-name>
<url-pattern>/StuUpdateservelt.to</url-pattern>
</servlet-mapping>
<servlet-mapping>


当点击修改为什么进不到stuUpdateservelt 这个里面啊

点击之后是这个样子:


求大佬指点下 !!!!!!!
...全文
565 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
QWERT4745 2018-04-24
  • 打赏
  • 举报
回复
访问不到页面应该会有404错误,再看下后台console有什么信息,这个无非就是配置文件路径和你访问要一致。 ps 你帖子标题两个英文全部拼错.........
qq_41924365 2018-04-23
  • 打赏
  • 举报
回复
<init-param> <param-name>zzz</param-name> <param-value>123</param-value> </init-param> 这个是什么意思呢 初始化么
zhx0114 2018-04-23
  • 打赏
  • 举报
回复
web.xml的配置貌似少了一部分
引用
<servlet> <servlet-name>DemoServlet</servlet-name> <servlet-class>servlet.DemoServlet</servlet-class> <init-param> <param-name>zzz</param-name> <param-value>123</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>DemoServlet</servlet-name> <url-pattern>/zzz</url-pattern> </servlet-mapping>

81,092

社区成员

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

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