java org.apache.jasper.JasperException: /Results.jsp(4,5) 无效的标准操作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10467681/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
org.apache.jasper.JasperException: /Results.jsp(4,5) Invalid standard action
提问by SNpn
I have the following jsp file
我有以下jsp文件
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="java.util.*" %>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jsp/jstl/core" version="2.0">
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Home</title>
<link rel="stylesheet" type="text/css" href="css/reset.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<div class="container">
<jsp:include page="/WEB-INF/embeds/header.jsp"/>
<div class="content">
<h>Hotel Results</h>
<table cellpadding="15">
<c:forEach var="result" items="${search}">
<tr>
<td style="padding: 0px 0px 8px 10px">
<c:out value="${search.roomDescription}"/>
</td>
</tr>
</c:forEach>
</table>
</div>
</div>
</body>
</html>
and a room
object that holds the int id
and String roomDescription
and I wanted to print these out from the arraylist i've used to store all the rooms from the results I got through ResultSet
. This code seems to error with
和room
对象,持有int id
和String roomDescription
,我想从我用来存储所有从我得到通过,结果房间的数组列表打印这些出ResultSet
。此代码似乎错误
org.apache.jasper.JasperException: /Results.jsp(4,5) Invalid standard action
org.apache.jasper.JasperException: /Results.jsp(4,5) Invalid standard action
Can someone tell me whats wrong with it? (My room class consists of those two variables and getters and setters). I've tested the size of the array list and I know I'm adding in room objects.
有人能告诉我它有什么问题吗?(我的房间类由这两个变量以及 getter 和 setter 组成)。我已经测试了数组列表的大小,我知道我正在添加房间对象。
回答by Stephen C
I think that the problem that is causing the exception is caused by the <jsp:root>
element, which according to this pageis malformed. If I am reading the linked page correctly, there should be a matching </jsp:root>
tag at the end of the JSP.
我认为导致异常的问题是由<jsp:root>
元素引起的,根据此页面的格式不正确。如果我正确阅读了链接页面,则</jsp:root>
JSP 末尾应该有一个匹配的标记。
Even if this isn't the exact problem, the exception messages says that the problem is at "[4,5]": i.e. line #4 character #5 of the JSP file.
即使这不是确切的问题,异常消息也会指出问题出在“[4,5]”:即 JSP 文件的第 #4 行字符 #5。
回答by PedroPK
I was having this same problem.
我遇到了同样的问题。
I was declaring a taglibbefore the <jsp:root>
, like this:
我在之前声明了一个标签库<jsp:root>
,如下所示:
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="psc" %>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
I inverted their order, and solved this issue
我颠倒了他们的顺序,并解决了这个问题
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="psc" %>
回答by Sanath
<c:forEach var="result" items="${search}">
<tr>
<td style="padding: 0px 0px 8px 10px">
<c:out value="${result.id}"/>
<c:out value="${result.roomDescription}"/>
</td>
</tr>
</c:forEach>
search attribute has to return a list of room objects, where they are iterated and displayed. you need to use the result variable that the values get assigned to.
search 属性必须返回一个房间对象列表,它们在那里被迭代和显示。您需要使用值被分配给的结果变量。