loginservlet.java_求助HTTP Status 404 - /Book/servlet/cn.servlet.LoginServlet
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
下面这个是我loginServlet代码 各位帮帮忙
package cn.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import cn.biz.UserBiz;
import cn.entity.User;
public class LoginServlet extends HttpServlet {
/**
* Destruction of the servlet.
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
/**
* The doGet method of the servlet.
*
* This method is called when a form has its tag value method equals to get.
*
* @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 doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out
.println(""-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("");
out.println("
A Servlet");
out.println("
");
out.print(" This is ");
out.print(this.getClass());
out.println(", using the GET method");
out.println(" ");
out.println("");
out.flush();
out.close();
doPost(request,response);
}
/**
* The doPost method of the servlet.
*
* 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 {
response.setContentType("text/html;charset=utf-8");
PrintWriter out = response.getWriter();
request.setCharacterEncoding("UTF-8");
String name=request.getParameter("userName");
String passWord=request.getParameter("passWord");
User user=new User();
user.setUserName(name);
user.setPassWord(passWord);
UserBiz userBiz=new UserBiz();
boolean result=userBiz.login(user);
HttpSession session=request.getSession();
if(result){
session.setAttribute("username",name);
response.sendRedirect("index.jsp");
}else{
request.setAttribute("message","用户名密码错误!");
request.getRequestDispatcher("login.jsp").forward(request,response);
}
}
/**
* Initialization of the servlet.
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}
}
loginservlet.java_求助HTTP Status 404 - /Book/servlet/cn.servlet.LoginServlet相关推荐
- HTTP Status 404 - The requested resource (/Test/loginSerlet) is not available.
像我这种菜鸟,刚刚开始学习JSP知识~~ HTTP Status 404 - /Test/loginSerlet type Status report message /Test/loginSerle ...
- HTTP Status 404 -(tomcat,springmvc,ModelAndView)
HTTP Status 404 -(tomcat,springmvc),访问404找不到路径解决: 问题1:把tomcat添加到eclipse下,直接访问"http://localhost: ...
- linux http status404,解决问题:HTTP Status 404(The requested resource is not avail
IE错误如下: HTTP Status 404 - /streetManager/index.jsp type Status report message /streetManager/index.j ...
- HTTP Status 404(The requested resource is not available)(转)
原文地址:http://hi.baidu.com/moonhai/blog/item/1fbfd1dfad063d5395ee37e4.html HTTP Status 404(The request ...
- HTTP Status 404 – 未找到:源服务器未能找到目标资源的表示或者是不愿公开一个已经存在的资源表示。
HTTP Status 404 – 未找到:源服务器未能找到目标资源的表示或者是不愿公开一个已经存在的资源表示. 先post个图: 再来聊一下我是怎么搞成这样的: 我自学Javaweb,看的是一本20 ...
- java 报错404_Javaweb工程运行报错HTTP Status 404解决办法
最近在学习jsp和servlet,避免不了的要和tomcat打交道,但tomcat经常会出现各式各样的错误,下面是我总结的一些常见的解决方法,希望对大家有用. 1.未部署web应用 2.url输入错误 ...
- TOMCAT报错:HTTP Status 404 -
构建struts2工程师,tomcat报错: HTTP Status 404 - type Status report message description The requested resour ...
- 解决 : Apache Tomcat/8.0.0-RC1 - Error report ... HTTP Status 404
前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家.点击跳转到教程. 1.报错: Apache Tomcat/8.0.0-RC1 - Error report HTTP ...
- struts2 上传文件 HTTP Status 404 - No result defined for action.....and result input
2019独角兽企业重金招聘Python工程师标准>>> struts2 在使用jqeury Ajax上传文件时报HTTP Status 404 - No result define ...
最新文章
- C/C++编译器mingw
- jquery表格复选框简单练习及prop(),attr()的应用原则
- 用Virtual PC 2007安裝Fedora Core 9
- 字节跳动2018校招算法方向(第一批) —— 1-最外层点
- Oracle中压缩数据节省空间和提高速度
- 弹性式分布数据集RDD——Pyspark基础 (二)
- P5072-[Ynoi2015]盼君勿忘【莫队,根号分治】
- cupload怎么保存图片_图片标注软件labelImg使用指南
- CentOS7 安装xen(在虚拟机上成功,实体机测试死机!)
- 第011讲 选择器使用细节 块元素和行内元素 盒子模型
- Netty源码分析第1章(Netty启动流程)----第3节: 服务端channel初始化
- zktime 协议_ZKTiMe5.0考勤管理系统使用介绍(1.3版).pdf
- TopoDOT | 基于三维激光LiDAR点云数据自动提取三维矢量特征信息——道路横断面
- 离散求边缘密度_求一把能退烧的机械键盘?——机械键盘购买“指北”
- 微信小程序订阅消息失败
- oracle pl sql面试题,Oracle 面试题库—PL/SQL
- 菜鸟、顺丰、京东物流:无“智”难行?
- iOS音视频开发十三:视频渲染,用 Metal 渲染
- 关于.MainActivity (server)' ~ Channel is unrecoverably broken and will be dispos
- 螺吡喃(SP)和有色开环的部花菁结构(MC)光致变色示意图
热门文章
- 【榜首团队专访】冲刺复赛,他们有绝招
- 机器学习深度学习知识点总结
- pytorch 语义分割loss_关于pytorch语义分割二分类问题的两种做法
- 是什么意思网络语_网络语“随薪锁欲”是什么意思?
- 联想台式主机拆机教程_联想发布全新刃9000台式主机:搭载英伟达最新显卡+8999元...
- 求数组中每个数字第一次出现的位置
- Leetcode每日一题:67.add-binary(二进制求和)
- EDAS-机器导入失败
- [CF280D]k-Maximum Subsequence Sum
- mysql 分库分表 后怎么操作,MySQL要分表分库怎么进行数据切分?