【发布时间】:2012-02-15 10:07:32
【问题描述】:
在我看来一切都很好,但我仍然收到异常 "org.apache.jasper.JasperException: Unable to compile class for JSP:"
请查收
- RootDirectory:- CallActionJsp
- RootDirectory/action.jsp
- 根目录/index.html
- 根目录/meta-inf
- RootDirectory/web-inf/classes/foo/Person.class
- 根目录/web-inf/web.xml
================================================ ==========================
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>
问候 安库尔
【问题讨论】: