// 定义类型 var Record = Ext.data.Record.create([{ name : 'stuId', type : 'int' }, { name : 'clsId', type : 'int' }, { name : 'stuSex', type : 'int' }, { name : 'stuName', type : 'string' }, { name : 'stuAge', type : 'int' },{ name : 'stuAddr', type : 'string' },{ name : 'stuTel', type : 'String' }]);
var store = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({ url : 'servlet/Query' }),
pruneModifiedRecords: true,
reader : new Ext.data.JsonReader({
totalProperty : 'totalProperty', root : 'root' }, [{ name : 'stuId' }, { name : 'clsId' }, { name : 'stuSex' }, { name : 'stuName' }, { name : 'stuAge' }, { name : 'stuAddr' }, { name : 'stuTel' }]) });
// var grid = new Ext.grid.GridPanel({ // 不可编辑的grid
var grid = new Ext.grid.EditorGridPanel({ // 可编辑的grid
title : '学生信息管理', autoHeight : true, cm : cm, sm : sm, renderTo : 'grid', store : store, // 分页底端显示工具条 bbar : new Ext.PagingToolbar({ pageSize : 10, displayInfo : true, store : store, displayMsg : '显示第{0}条到{1}条记录,一共{2}条', emptyMsg : '没有记录', doLoad: function(start){ record_start = start; var o = {},pn = this.paramNames; o[pn.start] = start; o[pn.limit] = this.pageSize; this.store.load({params:o}); } }),
// 添加与删除顶端显示工具条 tbar : new Ext.Toolbar(['-', {
text : '添加一行', handler : function() {
var p = new Record({ stuId : '', clsId: '1', stuSex : '', stuName : '', stuAge : '', stuAddr : '', stuTel: '' }); grid.stopEditing(); store.insert(0, p); grid.startEditing(0, 2); } }, '-', { text : '删除一行', handler : function() { Ext.Msg.confirm('信息', '确定要删除?', function(btn) { if (btn == 'yes') { var cells = sm.getSelections(); var jsonArray = []; for (var i = 0; i < cells.length; i++) {
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> This is the description of my J2EE component This is the display name of my J2EE component Query ext.servlet.Query
This is the description of my J2EE component This is the display name of my J2EE component Save ext.servlet.Save
This is the description of my J2EE component This is the display name of my J2EE component Del ext.servlet.Del
This is the description of my J2EE component This is the display name of my J2EE component GetCls ext.servlet.GetCls
List list = new ArrayList(); for ( int i = 0 ; i jsonObject = jsonArray.getJSONObject(i); pojoValue = JSONObject.toBean(jsonObject,pojoClass); list.add(pojoValue);
JSONArray jsonArray = JSONArray.fromObject(jsonString); String[] stringArray = new String[jsonArray.size()]; for( int i = 0 ; i stringArray[i] = jsonArray.getString(i);
JSONArray jsonArray = JSONArray.fromObject(jsonString); Long[] longArray = new Long[jsonArray.size()]; for( int i = 0 ; i longArray[i] = jsonArray.getLong(i);
JSONArray jsonArray = JSONArray.fromObject(jsonString); Integer[] integerArray = new Integer[jsonArray.size()]; for( int i = 0 ; i integerArray[i] = jsonArray.getInt(i);
} return integerArray; }
/** *//** * 从json数组中解析出java Date 型对象数组,使用本方法必须保证 * * @param jsonString * @return */ // public static Date[] getDateArray4Json(String jsonString,String DataFormat) { // // JSONArray jsonArray = JSONArray.fromObject(jsonString); // Date[] dateArray = new Date[jsonArray.size()]; // String dateString; // Date date; // // for( int i = 0 ; i// dateString = jsonArray.getString(i); // date = DateUtil.stringToDate(dateString, DataFormat); // dateArray[i] = date; // // } // return dateArray; // }
* * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response); }
/** * The doPost method of the servlet.
* * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
* * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response); }
/** * The doPost method of the servlet.
* * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
* * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response); }
/** * The doPost method of the servlet.
* * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
* * This method is called when a form has its tag value method equals to get. * * @param request * the request send by the client to the server * @param response * the response send by the server to the client * @throws ServletException * if an error occurred * @throws IOException * if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response); }
/** * The doPost method of the servlet.
* * This method is called when a form has its tag value method equals to * post. * * @param request * the request send by the client to the server * @param response * the response send by the server to the client * @throws ServletException * if an error occurred * @throws IOException * if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
/*==============================================================*/
/* DBMS name: MySQL 5.0 */
/* Created on: 2009-7-13 19:08:37 */
/*==============================================================*/
drop table if exists class;
drop table if exists student;
/*==============================================================*/
/* Table: class */
/*==============================================================*/
create table class
(
cls_id int not null auto_increment,
cls_name varchar(20),
cls_cdate varchar(10),
primary key (cls_id)
);
alter table student add constraint FK_Relationship_1 foreign key (cls_id)
references class (cls_id) on delete restrict on update restrict;
添加数据表:
insert into class values(null,'A班','2007-12-01');
insert into class values(null,'A班','2007-12-01');
insert into student values(null,1,'学生A',1,20,'福州','1111111');
insert into student values(null,2,'学生B',0,21,'福州','2222222');
insert into student values(null,1,'学生C',1,22,'福州','3333333');
insert into student values(null,2,'学生D',0,23,'福州','4444444');
insert into student values(null,1,'学生E',1,24,'福州','5555555');
insert into student values(null,2,'学生F',0,25,'福州','6666666');
insert into student values(null,1,'学生G',0,26,'福州','7777777');
insert into student values(null,2,'学生H',0,27,'福州','55055342555');
insert into student values(null,1,'学生I',0,18,'福州','55055333555');
insert into student values(null,1,'学生J',0,19,'福州','55055222555');
insert into student values(null,2,'学生K',0,19,'福州','55005551155');
insert into student values(null,2,'学生L',0,20,'福州','5055555555');
insert into student values(null,2,'学生M',1,21,'福州','5500055500055');
insert into student values(null,2,'学生N',1,23,'福州','55555523445');
insert into student values(null,2,'学生O',1,24,'福州','55530455555');
insert into student values(null,1,'学生P',1,25,'福州','55212055555');
insert into student values(null,1,'学生Q',1,24,'福州','5554450555');
insert into student values(null,1,'学生R',1,23,'福州','11111110');
insert into student values(null,2,'学生S',0,21,'福州','2222222');
insert into student values(null,1,'学生T',1,20,'福州','3333333');
insert into student values(null,1,'学生U',0,23,'福州','44444345404');
insert into student values(null,1,'学生V',1,24,'福州','5555555');
insert into student values(null,1,'学生W',1,19,'福州','5555565755');
insert into student values(null,1,'学生X',1,24,'福州','555553255');
insert into student values(null,2,'学生Y',1,22,'福州','555555634555');
insert into student values(null,2,'学生Z',1,22,'福州','5555522255');
insert into student values(null,2,'学生AA',1,18,'福州','55552342555');
insert into student values(null,1,'学生BB',1,17,'福州','5555523455');
insert into student values(null,1,'学生CC',0,24,'福州','5859404');
insert into student values(null,1,'学生DD',0,16,'福州','5553493');
insert into student values(null,1,'学生EE',0,16,'福州','5555555');
insert into student values(null,2,'学生FF',0,18,'福州','5553453');
insert into student values(null,2,'学生GG',1,17,'福州','5555533455');
insert into student values(null,1,'学生HH',1,18,'福州','5555234555');
Given a sorted linked list, delete all duplicates such that each element appear only once.
For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return&
在JDK1.5之前的单例实现方式有两种(懒汉式和饿汉式并无设计上的区别故看做一种),两者同是私有构
造器,导出静态成员变量,以便调用者访问。
第一种
package singleton;
public class Singleton {
//导出全局成员
public final static Singleton INSTANCE = new S