下了一个struts标签。不知道怎么用
就是displaytag这个表格变漂亮的标签
看见里面有tld文件
还有war文件
不知道这些怎么运用到我的工程中...
希望高手详细说明
------解决方案--------------------http://displaytag.sourceforge.net/
------解决方案--------------------displaytag可以在jsp页面中直接迭代出一个list对象,并且实现分页。其中name中的内容就是在Struts test这个Action类中存到session中去的list对象。。。详细请看下面例子。。。
======Action===========
public class TestAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm arg1,
HttpServletRequest request, HttpServletResponse arg3)
throws Exception {
List tblCtn = new ArrayList();
for (int i = 0; i < 100; i++) {
Map row1 = new HashMap();
row1.put( "name ", "Tom ");
row1.put( "age ", "10 ");
tblCtn.add(row1);
Map row2 = new HashMap();
row2.put( "name ", "White ");
row2.put( "age ", "100 ");
tblCtn.add(row2);
}
request.setAttribute( "tblCtn ", tblCtn);
return mapping.findForward( "success ");
}
}
====JSP================
<html>
<head>
<title> Insert title here </title>
<link type= "text/css " rel= "StyleSheet " href= "displaytag.css ">
</head>
<body>
<display:table name= "tblCtn " styleClass= "diplayTable "
requestURI= "/test.do " pagesize= "10 ">
<display:column property= "name " sortable= "true "
title= "name " titleKey= " "/>
<display:column property= "age " sortable= "true "
title= "age " />
</display:table>
</body>
</html>
------解决方案--------------------揩分吧