whatever_214 2016-05-30 15:46 采纳率: 42.9%
浏览 1393
已结题

servlet路径一直出问题,折腾一晚上没解决,求助,一运行就是404错误

程序代码:
图片说明

servlet文件代码:
package com.blog;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/blogservlet")
public class blogservlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public blogservlet() {
super();}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
String title = request.getParameter("title");
String content = request.getParameter("content");
String categoryId = request.getParameter("category");

    System.out.println(title);
    System.out.println(content);
    System.out.println(categoryId);
}

}

web.xml我没有进行配置,因为在网上搜了下servlet 3.0好像不需要手动配置
一晚上都被这个问题卡住,求解决方法

附图n张
图片说明
图片说明
图片说明

web.xml未改动如下
<?xml version="1.0" encoding="UTF-8"?>

blog

index.html
index.htm
index.jsp
default.html
default.htm
default.jsp

  • 写回答

6条回答

  • ___码字选手 2016-05-30 15:50
    关注

    先确认你输入的地址是localhost:+端口号+:/blogservlet

    评论

报告相同问题?

悬赏问题

  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛