页面报错500:无法为jsp编译解析类

这片文章记录当页面报错500:无法为jsp解析类,写这篇博客是为了以防以后遇到相同问题不记得怎么解决。

我报这个错的原因是在以下代码上修改:

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="com.samples.bean.*,java.util.*"%>

以上代码中的导包部分删掉就行了,

也就是import部分。

发布了12 篇原创文章 · 获赞 14 · 访问量 1万+
展开阅读全文

jsp页面中嵌入java代码报错

12-25

showMessage.jsp: <%@ page language="java" import="java.util.*,demo2.Message" pageEncoding="utf-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>查看问题</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> .line { border-bottom-width: 1px; border-bottom-style: dashed; border-bottom-color: #666; height: 10px; } body { margin-right: auto; margin-left: auto; text-align: center; max-width: 960px; } #main { border: 3px solid #999; background-color: #f5f5f5; padding: 1px; margin-right: auto; margin-left: auto; width: 960px; } #main table tr td { white-space: normal; } </style> </head> <body> <div id="main"> <div align="center"> <h1> 留言列表 </h1> </div> <% response.setCharacterEncoding("utf-8"); int p = 1; ArrayList messageList = (ArrayList) request.getAttribute("list"); int prep = p; // 上一页 int nextp = p; // 下一页 if (messageList.size() == 5) { nextp = p + 1; } if (p > 1) { prep = p - 1; } if (!messageList.isEmpty()) { for (int i = 0; i < messageList.size(); i++) { Message message = (Message) messageList.get(i); %> <table width="700" border="1" align="center" cellpadding="2" cellspacing="0"> <tr> <td width="130" align="right"> 姓名: </td> <td width="556" align="left"><%=message.getName()%></td> </tr> <tr> <td align="right"> 主题: </td> <td colspan="3" align="left"><%=message.getTitle()%></td> </tr> <tr> <td align="right"><span class="STYLE1">内容</span>: </td> <td colspan="3" align="left"><%=message.getContent()%></td> </tr> <div> <span style="float: right; clear: both"> <%=message.getTime()%> </span> <span><%=i + 1%>楼</span> </div> </table> <br> <div class="line"> </div> <br> <% } } else { out.print("<br><br>还没有留言!<br><br>"); } %> <div align="center"> <input type="button" value="上一页" onclick="window.location.href('MessageServlet?action=list&p=<%=prep%>')">   <input type="button" value="下一页" onclick="window.location.href('MessageServlet?action=list&p=<%=nextp%>')">   <input type="button" value="返回" onclick="window.location.href('../message.jsp')"> </div> </div> </body> </html> Mseeage.java: package demo2; public class Message { private int id; private String name; private String title; private String content; private String time; public String getTime() { return time; } public void setTime(String time) { this.time = time; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } } ![图片说明](https://img-ask.csdn.net/upload/201612/25/1482657466_171097.png) ![图片说明](https://img-ask.csdn.net/upload/201612/25/1482657524_998170.png) 问答

求大神帮忙:jsp报500错误

08-04

org.apache.jasper.JasperException: An exception occurred processing JSP page /BMS902A2.jsp at line 29 26: { 27: //w_conn = X60getConnection(hkalsip,hkalsdb,hkalslogin,hkalspwd); 28: w_conn = X60getConnection(dgalsip,dgalsdb,dgalslogin,dgalspwd); 29: w_stmt = w_conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE); 30: 31: w_rs = X61executeQuery(w_stmt, "SELECT fa_login FROM ta_user WHERE fa_login='" + p_login + "'"); 32: if (!w_rs.next()) Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:574) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) com.freestyle.common.servletsupport.RequestFilter.doFilter(RequestFilter.java:36) root cause java.lang.NullPointerException org.apache.jsp.BMS902A2_jsp.createUserForALS(BMS902A2_jsp.java:3287) org.apache.jsp.BMS902A2_jsp._jspService(BMS902A2_jsp.java:4016) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) com.freestyle.common.servletsupport.RequestFilter.doFilter(RequestFilter.java:36) 自己检查后,不清楚哪里错误,请大神帮忙! 问答

JSP页面无法编译,什么原因?

07-11

Stacktrace:] with root cause org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 6 in the jsp file: /WEB-INF/pages/base/pgis_roadwh.jsp Type mismatch: cannot convert from Object to String 3: String path = request.getContextPath(); 4: String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 5: 6: String xh = request.getAttribute("xh");//QWGL_BMQW_GW_DD表或QWGL_BMQW_GW_LXDD表主键 7: String pgispath = request.getAttribute("pgispath");//pgisJavascript访问路径 8: String sflxzq = request.getAttribute("sflxzq");//是否路线执勤 9: String glbm = request.getAttribute("glbm");//管理部门(汉子) An error occurred at line: 7 in the jsp file: /WEB-INF/pages/base/pgis_roadwh.jsp Type mismatch: cannot convert from Object to String 4: String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 5: 6: String xh = request.getAttribute("xh");//QWGL_BMQW_GW_DD表或QWGL_BMQW_GW_LXDD表主键 7: String pgispath = request.getAttribute("pgispath");//pgisJavascript访问路径 8: String sflxzq = request.getAttribute("sflxzq");//是否路线执勤 9: String glbm = request.getAttribute("glbm");//管理部门(汉子) 10: String gwlx = request.getAttribute("gwlx");//岗位类型(汉子) An error occurred at line: 8 in the jsp file: /WEB-INF/pages/base/pgis_roadwh.jsp Type mismatch: cannot convert from Object to String 5: 6: String xh = request.getAttribute("xh");//QWGL_BMQW_GW_DD表或QWGL_BMQW_GW_LXDD表主键 7: String pgispath = request.getAttribute("pgispath");//pgisJavascript访问路径 8: String sflxzq = request.getAttribute("sflxzq");//是否路线执勤 9: String glbm = request.getAttribute("glbm");//管理部门(汉子) 10: String gwlx = request.getAttribute("gwlx");//岗位类型(汉子) 11: String gwmc = request.getAttribute("gwmc");//岗位名称 An error occurred at line: 9 in the jsp file: /WEB-INF/pages/base/pgis_roadwh.jsp Type mismatch: cannot convert from Object to String 6: String xh = request.getAttribute("xh");//QWGL_BMQW_GW_DD表或QWGL_BMQW_GW_LXDD表主键 7: String pgispath = request.getAttribute("pgispath");//pgisJavascript访问路径 8: String sflxzq = request.getAttribute("sflxzq");//是否路线执勤 9: String glbm = request.getAttribute("glbm");//管理部门(汉子) 10: String gwlx = request.getAttribute("gwlx");//岗位类型(汉子) 11: String gwmc = request.getAttribute("gwmc");//岗位名称 12: String zqddmc = reuest.getAttribute("zqddmc");//执勤地点名称 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览