下面是我的 JSP 代码。 Insert title here data = new Ar-6ren">
gpt4 book ai didi

jsp - 属性数据的未知属性类型(对象)

转载 作者:行者123 更新时间:2023-12-02 05:00:16 26 4
gpt4 key购买 nike

JSP 页面错误。如何解决“属性数据的未知属性类型(对象)”。错误。错误指向">下面是我的 JSP 代码。

<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@taglib prefix="kendo" uri="http://www.kendoui.com/jsp/tags"%>
<!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=ISO-8859-1">
<title>Insert title here</title>
<link href="resources/styles/kendo.common.min.css" rel="stylesheet"
type="text/css" />
<link href="resources/styles/kendo.default.min.css" rel="stylesheet"
type="text/css" />

<script src="resources/js/jquery.min.js"></script>
<script src="resources/js/kendo.web.min.js"></script>

</head>
<body>
<%
List<String> data = new ArrayList<String>();
data.add("adaf");
data.add("bdfa");
data.add("cdasf");
%>

<div class="container">
<div class="row">
<kendo:dropDownList name="things">
<kendo:dataSource data="<%=data %>">
</kendo:dataSource>
</kendo:dropDownList>
</div>
</div>
</body>
</html>

错误信息:

SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /index.jsp(32,1) Unknown attribute type (Object) for attribute data.
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:236)
at org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1199)
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:846)
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:865)
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
at org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1763)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)

我的环境: Tomcat 6.0JDK1.7

最佳答案

当您在 JSP 页面中放置 JSP 表达式 ( <%=data %> ) 时,它应该包含一个字符串。在您的情况下,剑道数据源 data属性需要一个数组。

尝试转换 <%=data %>到形式为 ["adaf", "bdfa", "cdasf"] 的字符串使用以下内容:

${fn:join(data, ', ')}

关于jsp - 属性数据的未知属性类型(对象),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17018399/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com