在idea8上用DWR+ibatis+Ext +mysql 开发的小程序Word下载.docx

上传人:b****3 文档编号:17823354 上传时间:2022-12-11 格式:DOCX 页数:24 大小:21.48KB
下载 相关 举报
在idea8上用DWR+ibatis+Ext +mysql 开发的小程序Word下载.docx_第1页
第1页 / 共24页
在idea8上用DWR+ibatis+Ext +mysql 开发的小程序Word下载.docx_第2页
第2页 / 共24页
在idea8上用DWR+ibatis+Ext +mysql 开发的小程序Word下载.docx_第3页
第3页 / 共24页
在idea8上用DWR+ibatis+Ext +mysql 开发的小程序Word下载.docx_第4页
第4页 / 共24页
在idea8上用DWR+ibatis+Ext +mysql 开发的小程序Word下载.docx_第5页
第5页 / 共24页
点击查看更多>>
下载资源
资源描述

在idea8上用DWR+ibatis+Ext +mysql 开发的小程序Word下载.docx

《在idea8上用DWR+ibatis+Ext +mysql 开发的小程序Word下载.docx》由会员分享,可在线阅读,更多相关《在idea8上用DWR+ibatis+Ext +mysql 开发的小程序Word下载.docx(24页珍藏版)》请在冰豆网上搜索。

在idea8上用DWR+ibatis+Ext +mysql 开发的小程序Word下载.docx

/web-app>

2、Dwr.xml的配置

dwr>

allow>

!

--Userinfo-->

createcreator="

new"

javascript="

Userinfo"

scope="

application"

paramname="

class"

value="

com.seipher.dwr.UserInfoDWR"

/>

/create>

/allow>

/dwr>

3、entity:

下的实体

publicclassUserInfo{

//自增id

privateintid;

//姓名

privateStringname;

//电话

privateStringphone;

//住址

privateStringaddRess;

………………………………

UserInfo.xnl配置(主要填写操作这张表的sql语句)

?

DOCTYPEmapperPUBLIC"

-//ibatis.apache.org//DTDMapper3.0//EN"

"

//ibatis.apache.org/dtd/ibatis-3-mapper.dtd"

mappernamespace="

--增加记录-->

insertid="

create"

parameterType="

java.util.HashMap"

insertintostudent(name

iftest="

phone!

=null"

phone<

/if>

address!

address<

sex!

sex<

values(

#{name}

#{phone}<

#{address}<

#{sex}<

/insert>

--查询-->

selectid="

select"

resultType="

>

select*fromstudent

/select>

--删除-->

deleteid="

delete"

deletefromstudent

where>

data!

=null"

idin(${data})

id!

id=#{id}

/where>

/delete>

--修改信息-->

updateid="

update"

updatestudentsetname=#{name}

phone=#{phone}<

addRess!

addRess=#{addRess}<

sex=#{sex}<

/update>

--模糊查询-->

findList"

1=1

andid=#{id}

/mapper>

4、ibatis连接配置

属性文件

driver=com.mysql.jdbc.Driver

url=jdbc:

mysql:

//127.0.0.1:

3306/stu

username=root

password=root

连接数据库的文件

DOCTYPEconfiguration

PUBLIC"

-//ibatis.apache.org//DTDConfig3.0//EN"

//ibatis.apache.org/dtd/ibatis-3-config.dtd"

configuration>

propertiesresource="

net/ibatis/IbatisConfig.properties"

environmentsdefault="

stu"

environmentid="

transactionManagertype="

JDBC"

dataSourcetype="

POOLED"

propertyname="

driver"

${driver}"

url"

${url}"

username"

${username}"

password"

${password}"

/dataSource>

/environment>

/environments>

mappers>

mapperresource="

com/seipher/entity/UserInfo.xml"

/mappers>

/configuration>

5、dwr类文件

/**

*CreatedbyIntelliJIDEA.

*User:

王松

*Date:

2010-12-17

*Time:

10:

21:

06

*TochangethistemplateuseFile|Settings|FileTemplates.

*/

publicclassUserInfoDWR{

/**

*显示所以的信息

publicListshowFind(){

SqlSessionsqlSession=IbatisSessionFactory.getInstance().openSession();

try{

HashMapmap=newHashMap();

Listlist=sqlSession.selectList("

Userinfo.select"

map);

//System.out.print(list.size()+"

他的长度"

);

sqlSmit();

returnlist;

}catch(Exceptione){

System.out.print("

出现异常了!

"

}finally{

if(null!

=sqlSession)

sqlSession.close();

}

returnnull;

*创建信息

**/

publicStringcreateUs(MapformMap){

sqlSession.insert("

Userinfo.create"

formMap);

}catch(Exceptione){

出现异常"

+e.getMessage());

returne.getMessage();

}finally{

return"

true"

;

*进行批量删除

publicStringdeleteObj(MapformMap){

try{

sqlSession.delete("

Userinfo.delete"

*修改信息

publicStringupdateObj(MapformMap){

sqlSession.update("

Userinfo.update"

*模糊查询

publicListlineObj(MapformMap){

Userinfo.findList"

formMap);

}

6、index.jsp页面

%--

CreatedbyIntelliJIDEA.

User:

王松

Date:

Time:

9:

31:

21

TochangethistemplateuseFile|Settings|FileTemplates.

--%>

%@pagecontentType="

text/html;

charset=UTF-8"

language="

java"

%>

html>

head>

title>

查询所有的信息<

/title>

/head>

scriptsrc='

/dwr/interface/Userinfo.js'

/script>

scripttype="

text/javascript"

src="

/dwr/engine.js"

/js/util.js"

linkrel="

stylesheet"

type="

text/css"

href="

/ext-3.0.0/resources/css/ext-all.css"

/ext-3.0.0/examples/restful/restful.css"

/ext-3.0.0/adapter/ext/ext-base.js"

/ext-3.0.0/ext-all.js"

/ext-3.0.0/examples/ux/ProgressBarPager.js"

/ext-3.0.0/examples/ux/PanelResizer.js"

/ext-3.0.0/examples/ux/PagingMemoryProxy.js"

body>

divid="

grid-example"

/div>

tablewidth="

50%"

border="

1"

id="

table1"

tbodyid="

tby_test"

/tbody>

/table>

/body>

script>

/*ExtIs显示数据*/

functionshowerss(data){

varlen=data.length;

menage_users_info.splice(0,menage_users_info.length);

//清空array

//总行数

rowCount_=null!

=data.rowCount?

data.rowCount:

0;

for(vari=0;

i<

len;

i++){

menage_users_info[i]=['

inputstyle="

margin-top:

-5px;

checkbox"

name="

myCheckBox"

'

+data[i].id+'

data[i].id,

data[i].name,

data[i].phone,

data[i].addRess,

data[i].sex,

'

ahref="

update.jsp?

id='

修改<

/a>

];

menage_users_store.reload();

/*设定grid*/

//当前页数

varpage_=1;

//每页行数

varpageSize_=10;

//总行数

varrowCount_=10;

Ext.onReady(function(){

//读取页面参数

menage_users_store=newExt.data.Store({

proxy:

newExt.ux.data.PagingMemoryProxy(menage_users_info),

remoteSort:

true,

reader:

newExt.data.ArrayReader({

fields:

[

{

name:

checkbox'

},{

id'

name'

phone'

addRess'

sex'

修改'

]

})

});

//添加多选框

//varck=newExt.grid.CheckboxSelectionModel();

vargrid=newExt.grid.GridPanel({

store:

menage_users_store,

columns:

header:

批量操作'

width:

50,

sortable:

true

ID号"

100,

true,

dataIndex:

姓名"

editor:

newExt.grid.GridEditor(newExt.form.TextField({allowBlank:

false}))

电话"

住址"

200,

性别"

renderer:

functionSex

操作"

],

stripeRows:

//autoExpandColumn:

gys_name'

autoWidth:

height:

400,

frame:

title:

学生信息管理'

plugins:

newExt.ux.PanelResizer({

minHeight:

100

}),

bbar:

newExt.PagingToolbar({

pageSize:

pageSize_,

displayInfo:

newExt.ux.ProgressBarPager(),

//displayMsg:

显示第{0}条数据,到第{1}条数据,一共{2}条数据!

emptyMsg:

没有数据!

tbar:

[{

iconCls:

icon-xuanze'

text:

全选/反选'

handler:

function(){

checkboxXZ("

}},{

icon-search'

综合查询'

function(){

alert("

进行模糊查询"

},{

icon-user-add'

添加'

window.location.href('

addStu.jsp'

icon-shanchu'

删除'

delete_win();

}},

icon-tijiao'

保存修改'

//update_tj_win();

}}

],

clicksToEdit:

1

varmyview=newExt.Viewport({

layout:

fit'

items:

[grid]

myview.render('

grid

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 法律文书 > 调解书

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1