piao_liu
2009-09-05 15:12
浏览 236
已采纳

关于struts2的s:if标签问题

package com.shop.bean;

import java.util.List;

public class PageView {

private int currentPage = 1;

private long totalPage = 1;

private long totalRecord = 1;

private List records;

private int firstIndex = 1;

private PageIndex pageIndex;

private int maxResult = 12;

public PageView(int currentPage, int maxResult) {
this.currentPage = currentPage;
this.maxResult = maxResult;
this.firstIndex = currentPage * maxResult;
}

public int getCurrentPage() {
return currentPage;
}

public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}

public void setQueryResult(QueryResult qr){
setTotalRecord(qr.getTotal());
setRecords(qr.getDatas());
}

public long getTotalPage() {
return totalPage;
}

public void setTotalPage(long totalPage) {
this.totalPage = totalPage;
this.pageIndex = WebTool.getPageIndex(this.maxResult, this.currentPage, this.totalPage);
}

public long getTotalRecord() {
return totalRecord;
}

public void setTotalRecord(long totalRecord) {
this.totalRecord = totalRecord;
setTotalPage(totalRecord / this.maxResult == 0 ? totalRecord / this.maxResult : totalRecord / this.maxResult + 1);
}

public List getRecords() {
return records;
}

public void setRecords(List records) {
this.records = records;
}

public int getFirstIndex() {
return firstIndex;
}
public PageIndex getPageIndex() {
return pageIndex;
}

public void setPageIndex(PageIndex pageIndex) {
this.pageIndex = pageIndex;
}

public int getMaxResult() {
return maxResult;
}

public void setMaxResult(int maxResult) {
this.maxResult = maxResult;
}

public void setFirstIndex(int firstIndex) {
this.firstIndex = firstIndex;
}
}

画面的代码:

第 页 /s:if
/s:if
/s:iterator

action中的代码:
Map request = (Map )ActionContext.getContext().get("request");
request.put("pageView", pageView);

中="#request.pageView.pageIndex.pageList值能正常获取,可是 中的="#request.pageView.currentPage值获取不到正确的值,这是什么原因啊?
[b]问题补充:[/b]

第页/s:if
/s:if
/s:iterator

运行之后运行结果是两个条件语句都运行。这是怎么回事?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • iteye_10013 2009-09-05 15:23
    已采纳
    已采纳该答案
    打赏 评论
  • iteye_10013 2009-09-05 16:50

    打赏 评论

相关推荐 更多相似问题