根据我的说法,一切都很好,但我仍然得到一个例外,因为“org.apache.jasper.JasperException:无法为JSP编译类:”
请查看
=============================================== =========================
Index.html
<html>
<head>
<title>Index Page</title>
</head>
<body>
<form action="action.jsp" method="get">
<p align="left">Password: <input type="text" name="Password" /></p>
<BR>
<br>
<center><input type="SUBMIT" name="SUBMIT" /></center>
</form>
</body>
</html
Person.java
package foo;
public class Person
{
String name ;
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
}
action.jsp
<%@ page import="foo.*,java.util.Date"%>
<html>
<head>
<title>Action JSP</title>
</head>
<body>
<h1 align="center">Standard Actions are used Here.</h1>
<br>
<%
Person p = new Person();
Date date = new Date();
out.print(date);
String param = request.getParameter("Password");
out.print("<br>"+param);
%>
<a href="CallActionJsp">Call Again </a>
</body>
</html>
的web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<servlet>
<servlet-name>ActionJsp</servlet-name>
<jsp-file>/action.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>ActionJsp</servlet-name>
<url-pattern>/CallActionJsp</url-pattern>
</servlet-mapping>
</web-app>
此致 安库尔
答案 0 :(得分:1)
快速猜测 - 由于Person
中的小写web-inf
,找不到RootDircetory/web-inf/classes/foo/Person.class
?
WEB-INF
必须是大写名称,您可以尝试重命名吗?