- 浏览: 45927 次
- 性别:
- 来自: 太原
文章分类
最新评论
-
hyxingzi:
学习了
javaScript中firstChild IE与火狐方法的区别与兼容 -
jixuan1989:
赞! 请问楼主 “工作中使用过的struts2-jquery ...
struts2-jquery-plugin使用手册,自己写的 -
MR3CHEN:
我在使用grid的时候,出现中文乱码啊。。。就是传值到后台的时 ...
struts2-jquery-plugin使用手册,自己写的
struts-jquery-grid-tags 学习笔记
java 代码:
package com.topdt.message.web.action;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.interceptor.SessionAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.opensymphony.xwork2.ActionSupport;
import com.topdt.message.entity.Business;
import com.topdt.message.service.BusinessManager;
@Controller
@Scope("prototype")
@ParentPackage(value = "gloab-package")
@Namespace(value = "/message")
@Action(value = "business", results = {
@Result(name="query",type="json"),
@Result(name="show",location="/message/business/business_list.jsp")
})
public class BusinessAction extends ActionSupport implements SessionAware {
private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(BusinessAction.class);
private List<Business> gridModel;
private Integer rows;
private Integer page;
private String sord;
private String sidx;
private String searchField;
private String searchString;
private Integer totalrows;
private String searchOper;
private Integer total;
private Integer records;
private boolean loadonce;
private List<Business> myCustomers;
@Autowired
private BusinessManager businessManager;
public BusinessAction() {
this.rows = Integer.valueOf(0);
this.page = Integer.valueOf(0);
this.total = Integer.valueOf(0);
this.records = Integer.valueOf(0);
this.loadonce = false;
}
public String show() {
return "show";
}
public String query() {
this.myCustomers = businessManager.query();
if ((this.sord != null) && (this.sord.equalsIgnoreCase("asc"))) {
Collections.sort(this.myCustomers);
}
if ((this.sord != null) && (this.sord.equalsIgnoreCase("desc"))) {
Collections.sort(this.myCustomers);
Collections.reverse(this.myCustomers);
}
this.records = businessManager.getCustomersCount(this.myCustomers);
if (this.totalrows != null) {
this.records = this.totalrows;
}
int to = this.rows.intValue() * this.page.intValue();
int from = to - this.rows.intValue();
if (to > this.records.intValue())
to = this.records.intValue();
if (this.loadonce) {
if ((this.totalrows != null) && (this.totalrows.intValue() > 0)) {
setGridModel(this.myCustomers.subList(0, this.totalrows
.intValue()));
} else {
setGridModel(this.myCustomers);
}
} else if ((this.searchString != null) && (this.searchOper != null)) {
Long id = new Long(this.searchString);
if (this.searchOper.equalsIgnoreCase("eq")) {
log.debug("search id equals " + id);
List cList = new ArrayList();
Business business = businessManager.findById(this.myCustomers, id);
if (business != null)
cList.add(business);
setGridModel(cList);
} else if (this.searchOper.equalsIgnoreCase("ne")) {
log.debug("search id not " + id);
setGridModel(businessManager.findNotById(this.myCustomers, id, from, to));
} else if (this.searchOper.equalsIgnoreCase("lt")) {
log.debug("search id lesser then " + id);
setGridModel(businessManager.findLesserAsId(this.myCustomers, id, from, to));
} else if (this.searchOper.equalsIgnoreCase("gt")) {
log.debug("search id greater then " + id);
setGridModel(businessManager.findGreaterAsId(this.myCustomers, id, from, to));
}
} else {
setGridModel(businessManager.getCustomers(this.myCustomers, from, to));
}
this.total = Integer.valueOf((int) Math.ceil(this.records.intValue()
/ this.rows.intValue()));
return "query";
}
public String getJSON() {
return query();
}
public Integer getRows() {
return this.rows;
}
public void setRows(Integer rows) {
this.rows = rows;
}
public Integer getPage() {
return this.page;
}
public void setPage(Integer page) {
this.page = page;
}
public Integer getTotal() {
return this.total;
}
public void setTotal(Integer total) {
this.total = total;
}
public Integer getRecords() {
return this.records;
}
public void setRecords(Integer records) {
this.records = records;
if ((this.records.intValue() > 0) && (this.rows.intValue() > 0)) {
this.total = Integer.valueOf((int) Math.ceil(this.records
.intValue()
/ this.rows.intValue()));
} else {
this.total = Integer.valueOf(0);
}
}
public List<Business> getGridModel() {
return this.gridModel;
}
public void setGridModel(List<Business> gridModel) {
this.gridModel = gridModel;
}
public String getSord() {
return this.sord;
}
public void setSord(String sord) {
this.sord = sord;
}
public String getSidx() {
return this.sidx;
}
public void setSidx(String sidx) {
this.sidx = sidx;
}
public void setSearchField(String searchField) {
this.searchField = searchField;
}
public void setSearchString(String searchString) {
this.searchString = searchString;
}
public void setSearchOper(String searchOper) {
this.searchOper = searchOper;
}
public void setLoadonce(boolean loadonce) {
this.loadonce = loadonce;
}
public void setTotalrows(Integer totalrows) {
this.totalrows = totalrows;
}
public void setSession(Map<String, Object> session) {
}
}
package com.topdt.message.service;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.topdt.message.dao.BusinessDao;
import com.topdt.message.entity.Business;
import com.topdt.message.entity.Product;
@Service
@Transactional(readOnly = false)
public class BusinessManager {
private static Map<Long, Product> MAP_ID = new Hashtable<Long, Product>();
private static Map<String, Product> MAP_CODE = new Hashtable<String, Product>();
@Autowired
private BusinessDao businessDao;
@Transactional(readOnly = true)
public List<Business> query() {
return businessDao.queryAll();
}
public static List<Business> getCustomers(List<Business> list,
int from, int to) {
return list.subList(from, to);
}
public static Business findById(List<Business> list, Long id) {
for (Iterator i$ = list.iterator(); i$.hasNext();) {
Business business = (Business) i$.next();
if (business.getBusinessId()== id)
return business;
}
return null;
}
public static List<Business> findNotById(List<Business> list, Long id,
int from, int to) {
List sResult = new ArrayList();
for (Iterator i$ = list.iterator(); i$.hasNext();) {
Business Business = (Business) i$.next();
if (Business.getBusinessId() != id)
sResult.add(Business);
}
return sResult.subList(from, to);
}
public static List<Business> findGreaterAsId(List<Business> list,
Long id, int from, int to) {
List sResult = new ArrayList();
for (Iterator i$ = list.iterator(); i$.hasNext();) {
Business Business = (Business) i$.next();
if (Business.getBusinessId() > id)
sResult.add(Business);
}
return sResult.subList(from, to);
}
public static List<Business> findLesserAsId(List<Business> list,
Long id, int from, int to) {
List sResult = new ArrayList();
for (Iterator i$ = list.iterator(); i$.hasNext();) {
Business Business = (Business) i$.next();
if (Business.getBusinessId() < id)
sResult.add(Business);
}
return sResult.subList(from, to);
}
public static Integer getCustomersCount(List<Business> list) {
return Integer.valueOf(list.size());
}
public BusinessDao getBusinessDao() {
return businessDao;
}
public void setBusinessDao(BusinessDao businessDao) {
this.businessDao = businessDao;
}
}
发表评论
-
MapTour
2012-10-18 10:53 973MapTour MapTour ... -
应用程序发明家(app inventor) QuizMe 项目学习
2012-10-17 10:05 4837准备工作:下载实例图片 开始: 设置组件 ... -
用正则表达式和javascript对表单进行全面验证
2012-03-22 15:17 0代码:<!-- 使用时请将下面的javascrip ... -
正则表达式在JavaScript应用
2012-03-22 15:16 0-------------------------- ... -
正则表达式regular expression详述2
2012-03-22 15:14 0以下这些不是正则表 ... -
正则表达式regular expression详述(一)
2012-03-22 15:13 1091正则表达式是regular ex ... -
javascript正则表达式检验汇总
2012-03-22 15:12 916/****************************** ... -
JavaScript中的正则表达式汇总
2012-03-22 15:11 961正则表达式对象的属性及方法 预定义的正则表达式拥有 ... -
javascript的17种正则表达式
2012-03-22 15:10 859"^\\d+$" //非负整数(正整数 ... -
javascript 正则表达式
2012-03-22 15:09 0正则表达式是一个描述字符模式的对象。 JavaScrip ... -
正则表达式中的特殊字符
2012-03-22 15:07 1034字符 含意 \ 做为转意,即通常 ... -
SMIL 2.0 基础教程
2012-02-23 14:51 1052一、 简介 随着流技术的成熟和广泛的应用,其优点我们有了深深的 ... -
SMIL 2.0 基础教程
2012-02-23 14:35 0一、 简介 随着流技术的成熟和广泛的应用,其优点我们有了深深的 ... -
HTML5基础,第4部分:点睛之笔Canvas
2012-01-12 14:49 948原文地址:http://select. ... -
HTML5基础,第3部分:HTML5 API的威力
2012-01-12 14:43 963原文地址http://select.yee ... -
HTML5基础,第2部分:组织页面的输入
2012-01-12 14:38 1059HTML5反映了在网络上 ... -
HTML5基础,第1部分:初试锋芒
2012-01-12 14:24 881HTML5反映了在网络上和在云端实施业务的方式的巨大变化 ... -
巧用QQ空间动画制作网站欢迎Flash[转]
2011-12-30 17:20 1233巧用QQ空间动画制作网 ... -
利用apmserv搭建服务环境集成discuz+ecshop+phpcms完成企业综合平台
2011-12-29 17:37 2804第一步: 首先确保自 ... -
APMServ使用及下载
2011-12-29 17:06 1122APMServ 5.2.6 是一款拥 ...
相关推荐
struts2-jquery-plugin-3.1.0.jar
struts2-jquery-plugin-2.0.0 struts2-jquery-plugin-2.0.0 struts2-jquery-plugin-2.0.0
最新的struts2-jquery-plugin插件3.3.3,包括jquery-ui和grid,使用标签实现。
- 可以参考官方文档或者提供的示例代码学习如何使用Struts2-jQuery-Plugin。博主的博文链接(https://79343654.iteye.com/blog/1327488)可能包含更多实战经验。 - 在实际开发中,使用浏览器的开发者工具(如...
struts-api.chm + struts-tags.chm 原版struts-api.chm + struts-tags.chm 原版struts-api.chm + struts-tagsstruts-api.chm + struts-tags.chm 原版struts-api.chm + struts-tags.chm 原版struts-api.chm + struts-...
首先,`struts2-jquery-grid-showcase-3.3.0.zip`可能包含一个基于Struts2的jQuery Grid示例。jQuery Grid是一个功能强大的表格组件,它可以展示大量数据,并提供排序、分页、搜索和编辑等功能。在Struts2应用中使用...
struts-tags.tld struts-tags.tldstruts-tags.tld struts-tags.tld struts-tags.tld
struts-config.xml struts标准配置文件 struts-config
struts-taglib-1.3.8.jar struts-taglib-1.3.8.jar
struts2 jquery plugin ,学习struts2 ,又希望在其中使用Jquery的朋友,不妨看看
struts2-jquery-grid-plugin-3.5.1.jar 此jar包适合于struts2框架,一标签的形式实现grid插件,不过目前网络上此插件中文文档较少。
struts2-jquery插件源码。版本号3.0.1
struts2-jquery-plugin jar文件
赠送jar包:struts-core-1.3.8.jar; 赠送原API文档:struts-core-1.3.8-javadoc.jar; 赠送源代码:struts-core-1.3.8-sources.jar; 赠送Maven依赖信息文件:struts-core-1.3.8.pom; 包含翻译后的API文档:struts...
总的来说,"jakarta-struts-1.1.zip"包含的资源对于学习和理解早期Java Web开发,尤其是Struts框架的运作机制非常有价值。通过查阅其中的API文档,开发者可以深入理解如何使用Struts来构建高效、可维护的Web应用。...
struts2-core-2.0.1.jar, struts2-core-2.0.11.1.jar, struts2-core-2.0.11.2.jar, struts2-core-2.0.11.jar, struts2-core-2.0.12.jar, struts2-core-2.0.14.jar, struts2-core-2.0.5.jar, struts2-core-2.0.6.jar,...
学习 Struts 2.3.4 包含的这些知识点,有助于开发者更好地理解和构建基于 MVC 架构的 Java Web 应用程序。通过阅读提供的"上课日志",你可以深入学习每个概念的实际应用和示例,从而提升你的开发技能。
struts-2.3.7-all jar包
struts-spring-other-lib 等jar包struts-spring-other-lib 等jar包struts-spring-other-lib 等jar包struts-spring-other-lib 等jar包struts-spring-other-lib 等jar包struts-spring-other-lib 等jar包struts-spring-...
- **struts-core.jar**、**struts-el.jar**、**struts-faces.jar**等:特定功能的扩展库,如支持EL(Expression Language)和JSF(JavaServer Faces)。 使用Struts 1.3.8时,开发者需要配置web.xml和struts-config...