DWR增删改查Word格式文档下载.docx

上传人:b****3 文档编号:16926574 上传时间:2022-11-27 格式:DOCX 页数:10 大小:16.11KB
下载 相关 举报
DWR增删改查Word格式文档下载.docx_第1页
第1页 / 共10页
DWR增删改查Word格式文档下载.docx_第2页
第2页 / 共10页
DWR增删改查Word格式文档下载.docx_第3页
第3页 / 共10页
DWR增删改查Word格式文档下载.docx_第4页
第4页 / 共10页
DWR增删改查Word格式文档下载.docx_第5页
第5页 / 共10页
点击查看更多>>
下载资源
资源描述

DWR增删改查Word格式文档下载.docx

《DWR增删改查Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《DWR增删改查Word格式文档下载.docx(10页珍藏版)》请在冰豆网上搜索。

DWR增删改查Word格式文档下载.docx

}else{

添加失败!

}

/script>

<

/head>

body>

<

tableid="

mytable"

border="

1"

<

tr>

<

td>

用户名称

/td>

<

inputtype="

text"

name="

/>

/tr>

用户密码

button"

value="

添加"

onclick="

addAccount();

/table>

/body>

Index页面

window.onload=function(){

account.queryAll(callBackQueryAll);

functioncallBackQueryAll(data){

if(data!

=null){

for(vari=0;

i<

data.length;

i++){

varrow=document.getElementById("

).insertRow(

document.getElementById("

).rows.length);

row.insertCell(0).innerHTML=data[i].accountId;

row.insertCell

(1).innerHTML=data[i].accountName;

row.insertCell

(2).innerHTML=data[i].accountPwd;

row.insertCell(3).innerHTML="

ahref='

javascript:

deleteAccount("

+data[i].accountId

+"

'

删除<

/a>

&

nbsp;

update.jsp?

accountId="

+data[i].accountId+"

修改<

}

NO!

functiondeleteAccount(id){

account.deleteAccount(id,callBackDelete);

functioncallBackDelete(data){

删除成功!

window.location.href=window.location.href;

删除失败!

tralign="

center"

用户ID

操作

div>

ahref="

add.jsp"

添加<

/div>

Update页面

 

var$=document.getElementById;

functionqueryById(id){

account.queryById(id,callBackQueryById);

functioncallBackQueryById(data){

$("

accountId"

).value=data.accountId;

).value=data.accountName;

).value=data.accountPwd;

functionupdateAccount(){

varaccountId=$("

account.updateAccount(accountId,accountName,accountPwd,

callBackDelete);

更新成功!

更新失败!

bodyonload="

queryById(${param.accountId});

hidden"

${account.accountId}"

value="

${account.accountName}"

${account.accountPwd}"

更新"

updateAccount();

底层方法调用

publicList<

Account>

queryAll(){

List<

list=accountDAO.findAll();

returnlist.size()>

0?

list:

null;

publicAccountqueryById(intid){

Accountaccount=accountDAO.findById(id);

returnaccount!

=null?

account:

publicbooleanupdate(Accountaccount){

booleanflag=false;

try{

accountDAO.attachDirty(account);

flag=true;

}catch(Exceptione){

//TODOAuto-generatedcatchblock

e.printStackTrace();

returnflag;

publicbooleanupdateAccountBO(intaccountId,StringuserName,StringuserPwd){

Accountaccount=newAccount();

account.setAccountId(accountId);

account.setAccountName(userName);

account.setAccountPwd(userPwd);

returnaccountDAOImpl.update(account);

publicbooleandelete(intid){

Accountaccount=this.queryById(id);

accountDAO.delete(account);

publicbooleanadd(StringuserName,StringuserPwd){

Accountaccount=newAccount();

account.setAccountName(userName);

account.setAccountPwd(userPwd);

accountDAO.save(account);

Web.xml

!

--以classpath方式加载配置文件-->

context-param>

param-name>

contextConfigLocation<

/param-name>

param-value>

/WEB-INF/applicationContext.xml

/param-value>

/context-param>

--以listener方式加载-->

listener>

listener-class>

org.springframework.web.context.ContextLoaderListener<

/listener-class>

/listener>

--dwr-->

servlet>

servlet-name>

dwr-invoker<

/servlet-name>

servlet-class>

org.directwebremoting.servlet.DwrServlet<

/servlet-class>

init-param>

debug<

true<

/init-param>

/servlet>

servlet-mapping>

url-pattern>

/dwr/*<

/url-pattern>

/servlet-mapping>

welcome-file-list>

welcome-file>

index.jsp<

/welcome-file>

/welcome-file-list>

DWR.xml

dwr>

allow>

createcreator="

spring"

javascript="

account"

paramname="

beanName"

accountBO"

/param>

/create>

convertmatch="

com.scce.dwr.account.pojo.*"

converter="

bean"

/convert>

/allow>

/dwr>

Application.xml

beanid="

sessionFactory"

class="

org.springframework.orm.hibernate3.LocalSessionFactoryBean"

propertyname="

configLocation"

classpath:

hibernate.cfg.xml"

/property>

/bean>

AccountDAO"

class="

com.scce.dwr.account.pojo.AccountDAO"

refbean="

accountDAOImpl"

com.scce.dwr.account.pojo.AccountDAOImpl"

accountDAO"

com.scce.dwr.account.pojo.AccountBO"

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

当前位置:首页 > 成人教育 > 专升本

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

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