以下是我的register.jsp文件中的所有代码
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<html>
<head>
<title>register</title>
</head>
<body>
<form action="register.jsp" method="post">
account:
<input type="text" name="user"></input><br>
password :
<input type="password" name="password"></input><br>
<input type="submit" name = "submit" value = "Submit"></input>
<input type="reset" name = "reset" value = "Reset"></input>
</form>
</body>
</html>
<c:set var="user" value = ${param.user } scope = request></c:set>
<c:set var="password" value = ${param.password } scope = request></c:set>
<sql:setDataSource driver="oracle.jdbc.driver.OracleDriver" user="scott" password="669193"
url = "jdbc:oracle:thin:@//localhost:1521/orcl"/>
<sql:query var="query" sql = "select * from users where user =? and password = ?">
<sql:param value = ${user }></sql:param>
<sql:param value = ${password }></sql:param>
</sql:query>
<c:choose>
<c:when test="${!empty query.rows}">
<jsp:forward page="Hello.jsp"></jsp:forward>
</c:when>
</c:choose>
当我打开它时,浏览器会显示此错误 HTTP状态500
真的很感激任何帮助:)谢谢!
这是堆栈跟踪
输入例外报告
消息
说明服务器遇到内部错误(),导致其无法履行&gt;此请求。
例外
org.apache.jasper.JasperException:org.apache.jasper.JasperException:无法为JSP加载类&gt; org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:156) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
根本原因
org.apache.jasper.JasperException:无法加载JSP的类 org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:600) org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:144) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
根本原因
java.lang.ClassNotFoundException:org.apache.jsp.register_jsp java.net.URLClassLoader的$ 1.run(URLClassLoader.java:366) java.net.URLClassLoader的$ 1.run(URLClassLoader.java:355) java.security.AccessController.doPrivileged(本机方法) java.net.URLClassLoader.findClass(URLClassLoader.java:354) org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:134) org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66) org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:598) org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:144) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
答案 0 :(得分:0)
你可以发布整个堆栈跟踪吗?另外,为什么要在视图(JSP)中嵌入数据库连接逻辑?他们应该在控制器的某个地方。