我得到以下追踪
[#|2014-04-01T14:56:57.824+0200|WARNING|glassfish3.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=215;_ThreadName=Thread-1;|StandardWrapperValve[ServletExample]:
PWC1406: Servlet.service() for servlet ServletExample threw exception
org.apache.jasper.JasperException: PWC6033: Error in Javac compilation
for JSP
PWC6199: Generated servlet error: package
org.eclipse.persistence.platform.database does not exist
单击“提交”按钮时
<form action="servletexample" method="post">
<table border="0">
<tr>
<td>Vorname</td>
<td><input type="text" name="vorname" /></td>
</tr>
<tr>
<td>Nachname</td>
<td><input type="text" name="nachname" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="submit" /></td>
</tr>
</table>
</form>
这是我的JSP类:
package com.example.tutorial;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/servletexample")
public class ServletExample extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void service(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
if (request.getParameter("vorname") == null
|| request.getParameter("nachname") == null) {
getServletContext().getRequestDispatcher("/index.jsp").forward(
request, response);
return;
}
String vorname = request.getParameter("vorname");
String nachname = request.getParameter("nachname");
request.setAttribute("vorname", vorname);
request.setAttribute("nachname", nachname);
getServletContext().getRequestDispatcher("/output.jsp").forward(
request, response);
}
}
我正在使用Glasfish第3版。
有人能给我一个快速提示吗?
编辑:添加了output.jsp
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@page import="org.eclipse.persistence.platform.database.FirebirdPlatform"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</head>
<body>
<h1>Your first and last name is:</h1>
<%
String vorname = (String)request.getAttribute("vorname");
String nachname = (String)request.getAttribute("nachname");
out.print(vorname+" "+nachname);
%>
</body>
</html>
答案 0 :(得分:0)
由于Eclipse Generated导入导致失败,该导入位于我的output.jsp
中 <%@page import="org.eclipse.persistence.platform.database.FirebirdPlatform"%>
删除它解决了问题。