an class
class SearchInfo {
String input_part;
String search_part;
int current_page=0;
int total_find=0;
int total_pages=0;
int size=20;
/* set, get ....skip */
}
after search,
session.put("searchinfo", searchinfo);
at jsp,
<s:property value="#session.searchinfo.input_part"/> returns xxx
<s:property value="#session.searchinfo.total_find"/> returns 208
<s:property value="#session.searchinfo.total_pages"/> returns 11
<s:property value="#session.searchinfo.current_page"/> return 1
at bottom of jsp, i need to provide the page link, such as following
if current page is 1, the followign will display
1,2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,15,16,17,18,19
if current page is 22, the following will display
21........................39
so, i use the s:iterator to loop, but never works
<s:iterator value="%{#session.searchinfo.current_page}" var="page"
begin="(#session.searchinfo.current_page/20)*20+1"
end="(#session.searchinfo.current_page/20)+20" status="status" step="1">
<s:property value="#stauts.index"/>
</s:iterator>
But, it never works
for sttut1, i used jsp to implement the above, it is straight forward, but
struts2's OGNL looks like more complicate.
please advise
thanks in advance
john