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 请问有用MZmine处理 “Waters SYNAPT G2-Si QTOF质谱仪在MSE模式下采集的非靶向数据” 的分析教程吗
  • ¥50 opencv4nodejs 如何安装
  • ¥15 adb push异常 adb: error: 1409-byte write failed: Invalid argument
  • ¥15 nginx反向代理获取ip,java获取真实ip
  • ¥15 eda:门禁系统设计
  • ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页
  • ¥15 376.1电表主站通信协议下发指令全被否认问题
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥15 复杂网络,变滞后传递熵,FDA
  • ¥20 csv格式数据集预处理及模型选择