You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by red phoenix <ro...@gmail.com> on 2009/02/03 03:52:11 UTC
pager question in struts2+Pager Taglib2
I use struts2.0.14 and Pager Taglib2.0, I want to use Pager Taglib2.0 in
struts2
In action file
public String search() throws Exception{
System.out.println("call search");
....
request.setAttribute("index","center");
request.setAttribute("pageUrl","/test/search.action");
....
return SUCCESS;
}
in xml file
<action name="search.action" class="Test.MyAction" method="search">
<result>/test/mypage.jsp</result>
</action>
In jsp file
<s:form action="search.action">
<pg:pager
items="${request.items}"
index="center"
maxPageItems="${request.maxPageItems}"
maxIndexPages="${request.maxIndexPages}"
isOffset="true"
export="offset,currentPageNumber=pageNumber"
scope="request">
<pg:prev export="pageUrl" ifnull="<%= true %>">
<% if (pageUrl != null) { %>
<td align=right><A HREF="<%= pageUrl %>"><IMG
SRC=http://www.google.com/nav_previous.gif alt="" border=0><br>
<b>Previous</b></A></td>
<% } else { %>
<td><IMG SRC=http://www.google.com/nav_first.gif alt="" border=0></td>
<% } %>
</pg:prev>
<pg:pages>
<% if (pageNumber == currentPageNumber) { %>
<td><IMG SRC=http://www.google.com/nav_current.gif alt=""><br>
<font color=#A90A08><%= pageNumber %></font></td>
<% } else { %>
<td><A HREF="<%= pageUrl %>"><IMG
SRC=http://www.google.com/nav_page.gif alt="" border=0><br>
<%= pageNumber %></A></td>
<% } %>
</pg:pages>
<pg:next export="pageUrl" ifnull="<%= true %>">
<% if (pageUrl != null) { %>
<td><A HREF="<%= pageUrl %>"><IMG
SRC=http://www.google.com/nav_next.gif alt="" border=0><br>
<b>Next</b></A></td>
<% } else { %>
<td><IMG SRC=http://www.google.com/nav_last.gif alt="" border=0></td>
<% } %>
</pg:next>
When I run above code,it can run well,but when I click next page
button,tomcat raise a warning message:
Warn: No configuration found for the specified action: 'search' in
namespace: '/test/mypage'. Form action defaulting to 'action' attribute's
literal value.
Why raise above warning message? I guess when click next button,it should
call action search method,why it don't call it? How to correct above code?
Thanks!