使用struts2显示标签
我正在尝试对从操作类传递的 ArrayList 使用显示标记。
Action 类
public List<AccessLog> getAccessLogList() throws ParseException
{
AccessLogManager am = new AccessLogManager(Config.getInstance());
ArrayList<AccessLog> accessLogList = new ArrayList<AccessLog>();
accessLogList = am.getAccessLog(userId, actionId, searchStartDate, searchEndDate);
HttpSession sessAccessLog = req.getSession();
sessAccessLog.setAttribute("accessLogListSession", accessLogList);
return accessLogList;
}
JSP 页面
<display:table id="accessLogList" name="accessLogList" requestURI="SessionLogAction" pagesize="10" defaultsort="1" >
<display:column property="accessLogId" title="LogId" sortable="true" headerClass="sortable" />
<display:column property="username" title="Username" sortable="true" headerClass="sortable"/>
<display:column property="actionName" title="Action" sortable="true" headerClass="sortable"/>
<display:column property="description" title="Description" sortable="true" headerClass="sortable"/>
<display:column property="remark" title="Remark"/>
<display:column property="timeStamp" title="TimeStamp" sortable="true" headerClass="sortable"/>
</display:table>
虽然我可以看到 HTML 中的第一页,但所有页面链接(例如 2,3 等)都不起作用。所以我试图在会话中传递数组列表值。但我又面临新的错误。
我的问题是如何使页面链接在带有struts2的显示标签中工作。我找到了struts1的示例,但没有找到struts2的示例。提前致谢。
I am trying to use display tag for my ArrayList passed from action class.
Action Class
public List<AccessLog> getAccessLogList() throws ParseException
{
AccessLogManager am = new AccessLogManager(Config.getInstance());
ArrayList<AccessLog> accessLogList = new ArrayList<AccessLog>();
accessLogList = am.getAccessLog(userId, actionId, searchStartDate, searchEndDate);
HttpSession sessAccessLog = req.getSession();
sessAccessLog.setAttribute("accessLogListSession", accessLogList);
return accessLogList;
}
JSP Page
<display:table id="accessLogList" name="accessLogList" requestURI="SessionLogAction" pagesize="10" defaultsort="1" >
<display:column property="accessLogId" title="LogId" sortable="true" headerClass="sortable" />
<display:column property="username" title="Username" sortable="true" headerClass="sortable"/>
<display:column property="actionName" title="Action" sortable="true" headerClass="sortable"/>
<display:column property="description" title="Description" sortable="true" headerClass="sortable"/>
<display:column property="remark" title="Remark"/>
<display:column property="timeStamp" title="TimeStamp" sortable="true" headerClass="sortable"/>
</display:table>
Although I can see the first page in HTML, all the pagelinks (such as 2,3,etc..) are not working. So I am trying to pass the arraylist value in Session. But I am facing new error again.
My question is How can I make the page links to work in Display Tag with struts2. I found example with struts1, but not with struts2. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最后我修好了。
请使用将映射到特定操作的操作名称。它工作完美。
例如:
finally I fixed it.
Please use the action name that will be map to the specific action. It works perfectly.
for example: