JAVAWeb问题总结(持续更新)

1.在JSP页面头部,出现如下错误:

 

错误文本:

  Multiple annotations found at this line:
  - The superclass "javax.servlet.http.HttpServlet" was not found on the Java
  Build Path
  - The superclass "javax.servlet.http.HttpServlet" was not found on the Java
  Build Path

问题产生原因:

  未为本网站项目正确配置Tomcat服务器。

解决方案:

  1、右键项目-build path

  2、选择configure build path...

  3、选择 java build path

  4、Add Library –> server Runtime -> Click Next

  5、选择  Server runtime (我的是 Tomcat 8.5) –>完成

2、(使用Eclipse内置浏览器时)通过session.getAttribute方法获取对象为null,出现空指针异常:

  

问题产生原因:

  使用中文名称作为项目名,具体细节未知。

解决方案:

  右击项目——Refactor——Rename,将项目名改为英文。

  谨记:使用中文作为项目名、使用中文路径等都是开发工作的大忌!

3.JSP请求参数过多时,跳转至页面为空,并且控制台出现错误如下图:

错误文本:

  信息: Error parsing HTTP request header
  Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
  java.lang.IllegalArgumentException: Request header is too large

 问题产生原因:

  请求头信息过大

解决方案:

  

4.Eclipse中,修改文件,按Ctrl+S保存时,出现:

错误文本:

  Could not write file: D:eclipse-workspaceArithmeticWebContentarithmetic.jsp.
  D:eclipse-workspaceArithmeticWebContentarithmetic.jsp (另一个程序正在使用此文件,进程无法访问。)

问题产生原因:

  正使用TIM在线传输该文件(不是发送离线文件)。对方未接受,所以文件一直被占用。

解决方案:

  TIM中更改为发送离线文件。

原文地址:https://www.cnblogs.com/lzq666/p/7977951.html