日期:2014-05-16 浏览次数:20293 次
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <!-- 设置字符编码为UTF-8 --> <constant name="struts.i18n.encoding" value="UTF-8"></constant> <!-- 设置上传文件方式为jakarta --> <constant name="struts.multipart.parser" value="jakarta"></constant> <!-- 设置上传文件最大字节为:2097152 --> <constant name="struts.multipart.maxSize" value="2097152"></constant> <!-- 提交时的后缀名,如XXXX.action --> <constant name="struts.action.extension" value="action"></constant> <!-- 设置项目为开发模式 --> <constant name="struts.devMode" value="true"></constant> <!-- 资源文件若修改,则自动加载 --> <constant name="struts.i18n.reload" value="true"></constant> <!-- 主题 --> <constant name="struts.ui.theme" value="simple"></constant> <!-- 配置文件若修改,则自动加载 --> <constant name="struts.configuration.xml.reload" value="true"></constant> <!-- Spring 自动装配 --> <constant name="struts.objectFactory" value="spring"></constant> <!-- Spring配置文件若修改则 自动加载 --> <constant name="struts.objectFactory.spring.autoWire" value="type"></constant> <!-- 全局的国际化资源文件,在类型转换错误时,需要转换的信息内容在errorMassage.prop文件中定义 --> <constant name="struts.custom.i18n.resources" value="massage"></constant> <!-- Struts拦截相应的请求后分发给不同的模块来处理 --> <package name="strutspackage" extends="json-default"> <action name="yinyue" class="com.yxps.action.YinyueAction"> <result type="json"></result> </action> <action name="syslb" class="com.yxps.action.SysLbAction"> <result type="json"></result> </action> </package> </struts> YinyueAction.java package com.yxps.action; import java.util.List; import com.googlecode.jsonplugin.annotations.JSON; import com.yxps.entity.Yinyue; import com.yxps.service.IYinyueService; /** * 音乐业务逻辑类 * @author Administrator * */ public class YinyueAction extends BaseCRUDAction { private Yinyue yinyue; public Yinyue getYinyue() { return yinyue; } public void setYinyue(Yinyue yinyue) { this.yinyue = yinyue; } public Integer getStart() { return start; } public void setStart(Integer start) { this.start = start; } public Integer getLimit() { return limit; } public void setLimit(Integer limit) { this.limit = limit; } public Integer getTotal() { return total; } public void setTotal(Integer total) { this.total = total; } // 当前第几页 private Integer start = 0; // 每页多少条记录 private Integer limit = 5; // 总记录数 private Integer total = 0; private List<Yinyue> list; @JSON(name = "list") public List<Yinyue> getList() { return list; } public void setList(List<Yinyue> list) { this.list = list; } public void setYinyueService(IYinyueService yinyueService) { this.yinyueService = yinyueService; } private IYinyueService yinyueService; @Override public String doAdd() { // TODO Auto-generated method stub return null; } @Override public String doDelete() { // TODO Auto-generated method stub return null; } /** * 分页查询音乐: * 参数:start:第几页、 * limit:每页显示数量 */ @Override public String doList() { // TODO Auto-generated method stub //设置总数 this.total=yinyueService.getAllYinyue().size(); //查询当前页的音乐 this.list=yinyueService.findYinyueByPage(this.start,this.limit); return this.SUCCESS; } @Override public String doUdate() { // TODO Auto-generated method stub return null; } } 数据访问层在此就不写了。接下来看看js Ext.onReady(function() { Ext.BLANK_IMAGE_URL = 'extjs/resources/images/default/s.gif'; Ext.QuickTips.init(); Ext.form.Field.prototype.msgTarget = 'side';//设置控件的错误信息的显示位置 /* 定义选择按钮 */ var sm = new Ext.grid.CheckboxSelectionModel(); // CheckBox选择列 var btn_test_yinyue=new Ext.Button({ te