首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

extremecomponents组件运用

2013-03-12 
extremecomponents组件使用异常代码如下:TableTag Problem: javax.servlet.jsp.JspException: TableTag.do

extremecomponents组件使用
异常代码如下:TableTag Problem: javax.servlet.jsp.JspException: TableTag.doAfterBody() Problem: java.lang.Exception: You need to specify the totalRows (as an Integer) to use the org.extremecomponents.table.callback.LimitCallback.

页面的内容为:
<ec:table 
    items="resultList"
    var="item"
 retrieveRowsCallback="org.extremecomponents.table.callback.LimitCallback"
 action="http://localhost:8080/public/buy.action"
 imagePath="${pageContext.request.contextPath}/themes/default/images/table/*.gif"
 width="100%"
 rowsDisplayed="10"
 showStatusBar="false"
 styleClass="eXtremeTable_info"
 filterable="false"
 sortable="false">
 <ec:row highlightRow="true">
  <ec:column property="requiresubject" title="求购名"/>
  <ec:column property="buycontent" title="要求"/>
  <ec:column property="money" title="价格"/>
        <ec:column property="buytime" title="求购日期"/>
    </ec:row>
</ec:table>
怎么回事,我的数据库里有数据啊,各位帮帮忙
[解决办法]
我是这么用的:
jsp:
<div align="center">
<ec:table items="resultList" var="item" retrieveRowsCallback="limit"
filterRowsCallback="limit" sortRowsCallback="limit"
action="${pageContext.request.contextPath}/jsp/vibrationphone/vibrationPhoneAction.do?method=list"
title="查询结果" showStatusBar="true" sortable="false">

<ec:row highlightRow="true">
<ec:column property="vibrationPhone" title="电话号码" styleClass="centercol" />
<ec:column property="vibrationType" title="类型" styleClass="centercol" />
<ec:column property="serNum" title="轮振顺序" styleClass="centercol" />
<ec:column property="name" title="操作" styleClass="centercol"><a href="javascript:update(${item.id})">修改</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:if(confirm('确定要删除吗?')){del('${item.id}')}">删除</a></ec:column>
</ec:row>
</ec:table>
</div>


action.do


public ActionForward list(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
VibrationPhoneForm vibrationPhoneForm = (VibrationPhoneForm) form;
try {
String subscriberId=vibrationPhoneForm.getSubscriberId();
List list=getLogicDaoServiceInter().findVibrationPhone(subscriberId);
String dc = request.getParameter("ec_p");

if (dc == null 
[解决办法]
 dc.equals(""))
dc = "1";
vibrationPhoneForm.setCurrPageNum(dc);

/**
 * 
 * 首先需要创建一个Limit
 */

String tableId = "";

Context context = new HttpServletRequestContext(request);

LimitFactory limitFactory = new TableLimitFactory(context, tableId);

Limit limit = new TableLimit(limitFactory);

/**
 * 
 * 得到系统默认的页面显示大小
 */

Preferences preferences = new TableProperties();



preferences.init(null, TableModelUtils
.getPreferencesLocation(context));

/**
 * 
 * 注意:此处取值时,如果后台配置文件里有配置,就从里面取,反之取15
 */

String pageSize = request.getParameter("ec_rd");
int defaultRowsDisplayed = Integer.parseInt(preferences
.getPreference(PreferencesConstants.TABLE_ROWS_DISPLAYED));

if (pageSize != null && !pageSize.equals(""))
defaultRowsDisplayed = Integer.parseInt(pageSize);

vibrationPhoneForm.setPageSize(String.valueOf(defaultRowsDisplayed));



int totalRows = list.size();

limit.setRowAttributes(totalRows, defaultRowsDisplayed);
request.setAttribute("totalRows", new Integer(totalRows));
request.setAttribute("resultList", list);


} catch (Exception e) {
System.out.println("查询失败" + e.getMessage());
e.printStackTrace();
this.addMessage(request, "查询失败= "+e.getMessage());
}

return mapping.findForward("list");
}

热点排行