struts2 dojo有问题。在我的jsp中,没有显示任何内容。 我在eclipse中使用Struts-dojo-plugin 我需要你的帮助 这是我的代码:
我的集体诉讼
public class BooksTreeAction extends ActionSupport
{
/**
*
*/
private static final long serialVersionUID = 8854378801207110908L;
@Override
public String execute() throws Exception {
// TODO Auto-generated method stub
return SUCCESS;
}
public Book getBooksTree() {
Book bk = new Book();
bk.setBookId("BK005");
bk.setBookName("Java Books");
Book bk2 = new Book();
bk2.setBookId("BK003");
bk2.setBookName("Java Books");
Book bk3 = new Book();
bk3.setBookId("BK004");
bk3.setBookName("Java Books");
Book bk4 = new Book();
bk4.setBookId("BK002");
bk4.setBookName("Java Books");
Book bk1 = new Book();
bk1.setBookId("C001");
bk1.setBookName("Books");
List list = new ArrayList();
list.add(bk);
list.add(bk4);
list.add(bk3);
list.add(bk2);
bk1.setBooksList(list);
return bk1;
}
我的ex.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib uri="/struts-dojo-tags" prefix="sx" %>
<!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>
<sx:head/>
</head>
<body>
test tree
<sx:datetimepicker name="deliverydate" label="Delivery Date"
displayFormat="dd/MM/yyyy" />
<div>
<sx:tree id="treeOfBooks" rootNode="%{booksTree}"
nodeIdProperty="bookId" nodeTitleProperty="bookName"
childCollectionProperty="booksList"/>
</div>
</body>
</html>
这是结果
源代码ex.jsp
<!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>
<script language="JavaScript" type="text/javascript">
// Dojo configuration
djConfig = {
isDebug: false,
bindEncoding: "UTF-8"
,baseRelativePath: "/test0/struts/dojo/"
,baseScriptUri: "/test0/struts/dojo/"
,parseWidgets : false
};
</script>
<script language="JavaScript" type="text/javascript"
src="/test0/struts/dojo/struts_dojo.js"></script>
<script language="JavaScript" type="text/javascript"
src="/test0/struts/ajax/dojoRequire.js"></script>
<link rel="stylesheet" href="/test0/struts/xhtml/styles.css" type="text/css"/>
<script language="JavaScript" src="/test0/struts/utils.js" type="text/javascript"></script>
<script language="JavaScript" src="/test0/struts/xhtml/validation.js" type="text/javascript"></script>
<script language="JavaScript" src="/test0/struts/css_xhtml/validation.js" type="text/javascript"></script>
</head>
<body>
test tree
<tr>
<td class="tdLabel"><label for="widget_972324328" class="label">Delivery Date:</label></td>
<td
><div
dojoType="struts:StrutsDatePicker" id="widget_972324328" name="deliverydate" inputName="dojo.deliverydate" displayFormat="dd/MM/yyyy" saveFormat="rfc"></div>
</td>
</tr>
<script language="JavaScript" type="text/javascript">djConfig.searchIds.push("widget_972324328");</script>
<div>
<script type="text/javascript">
<!--
dojo.require("dojo.lang.*");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.Tree");
// dojo.hostenv.writeIncludes();
-->
</script>
<div dojoType="struts:StrutsTree"
id="treeOfBooks"
toggle="fade"
>
<div dojoType="struts:StrutsTreeNode" title="Books" id="C001">
<div dojoType="struts:StrutsTreeNode" title="Java Books" id="BK005">
</div>
<div dojoType="struts:StrutsTreeNode" title="Java Books" id="BK002">
</div>
<div dojoType="struts:StrutsTreeNode" title="Java Books" id="BK004">
</div>
<div dojoType="struts:StrutsTreeNode" title="Java Books" id="BK003">
</div>
</div>
</div>
<script language="JavaScript" type="text/javascript">
djConfig.searchIds.push("treeSelector_treeOfBooks");
djConfig.searchIds.push("treeOfBooks");
</script>
</div>
</body>
</html>