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

关于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
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘