我有一个具有以下属性的对象列表
公共类 ViewTestCasesBean {
private String testcaseName;
private String subject;
private String description;
private List<TestCaseDetailsBean> testList = new ArrayList<TestCaseDetailsBean>();
// GETTERS AND SETTERS SECTION.......///////
public String getTestcaseName() {
return testcaseName;
}
public void setTestcaseName(String testcaseName) {
this.testcaseName = testcaseName;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<TestCaseDetailsBean> getTestList() {
return testList;
}
public void setTestList(List<TestCaseDetailsBean> testList) {
this.testList = testList;
}
}
现在我的操作代码是......
public String execute() {
detailsList = viewTestCasesTransaction.fetchTestCases();
session.put("testcaseList", detailsList);
if (detailsList.size() > 0) {
return SUCCESS;
}
return ERROR;
}
这里的 detailsList 是上面要显示在 display 标签中的对象的 List。
我尝试了以下
<jsp:root version="1.2" xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="urn:jsptld:http://java.sun.com/jstl/core">
<%@page import="org.apache.jasper.tagplugins.jstl.core.Import"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="java.util.*"%>
<%@ page import="com.harmony.cloud.bean.TestCaseDetailsBean"%>
<%@ page import="com.harmony.cloud.action.ViewTestCasesAction"%>
<%@ page import="java.sql.*"%>
<%@ page isELIgnored="false"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Test Cases List</title>
</head>
<body>
<%session.getAttribute("testcaseList"); %>
<display:table name="detailsList" id="parent">
<display:column property="testcaseName" />
<display:column property="subject" />
<display:column property="description" title="Comments" />
<c:set var="nestedName"
value="detailsList[${parent_rowNum -1}].testcaseList}" />
<display:table name="${nestedName}" id="child${parent_rowNum}" >
<display:column title="Steps">
</display:table>
</display:column>
<display:setProperty name="paging.banner.placement" value="top" />
</display:table>
</body>
</html>
但是出现以下错误......
org.apache.jasper.JasperException: /testCasesView.jsp (line: 3, column: 3) 元素的内容必须由格式良好的字符数据或标记组成。org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:408) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher. java:89) org.apache.jasper.compiler.JspDocumentParser.parse(JspDocumentParser.java:207) org.apache.jasper.compiler.ParserController.doParse(ParserController.java:226) org.apache.jasper.compiler.ParserController。 parseDirectives(ParserController.java:119) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:193) org.apache.jasper.compiler.Compiler.compile(Compiler.java:373) org.apache.jasper。 compiler.Compiler.compile(编译器。
编码有什么问题?