锘??xml version="1.0" encoding="utf-8" standalone="yes"?>视频一区二区三区国产,欧美成人午夜免费视在线看片,97se亚洲综合http://blogjava.net/smallfa/category/29725.htmlzh-cnThu, 28 Feb 2008 19:08:09 GMTThu, 28 Feb 2008 19:08:09 GMT60dwr 閰嶇疆http://www.aygfsteel.com/smallfa/archive/2008/02/28/182765.htmlsmallfasmallfaThu, 28 Feb 2008 10:12:00 GMThttp://www.aygfsteel.com/smallfa/archive/2008/02/28/182765.htmlhttp://www.aygfsteel.com/smallfa/comments/182765.htmlhttp://www.aygfsteel.com/smallfa/archive/2008/02/28/182765.html#Feedback0http://www.aygfsteel.com/smallfa/comments/commentRss/182765.htmlhttp://www.aygfsteel.com/smallfa/services/trackbacks/182765.html
2:欏甸潰
<%@ page language="java" pageEncoding="UTF-8"%>
      <script type='text/javascript' src='../dwr/engine.js'></script>
        <script type='text/javascript' src='../dwr/util.js'></script>
        <script type='text/javascript' src='../dwr/interface/checkuser.js'></script>
       <script type='text/javascript'>
            function  check(form)
          {
         
           var id=document.getElementById("id").value;
           if(id=="new")
           {
           regUserChked(form);
           }
           else
           {
          
           RegUserChked(form);
             
           }
          }
        
        
        
        
        
        
        
        
        
        
          function regUserChked(form){ 
          
             var username= document.getElementById("username").value;
           
            
              if(username=="")
              {
            
              alert("鐢ㄦ埛鍚嶄笉鑳戒負(fù)絀?")
           
              return false;
              }
             
              checkuser.isExist(username,showData);//showData鍥炶皟鍑芥暟  
              
               
           } 
          
            function RegUserChked(form){ 
           
              var id=document.getElementById("id").value;
              var username= document.getElementById("username").value;
              if(username=="")
              {
            
              alert("鐢ㄦ埛鍚嶄笉鑳戒負(fù)絀?")
           
              return false;
              }
            
                checkuser.IsExistUpdate(username,id,ShowData);  //showData鍥炶皟鍑芥暟  
            }
          
          
          
          
          
          
          
          function showData(data){  
            if(data){  
              alert('璇ョ敤鎴峰凡琚敞鍐屼簡(jiǎn)!');
            }else{  
              alert('璇ョ敤鎴鋒湭琚敞鍐屼簡(jiǎn)!');  
             }  
          }  
         
           function ShowData(data){  
            if(data){  
              alert('璇ョ敤鎴峰凡琚敞鍐屼簡(jiǎn)!');
            }else{  
              alert('鍙互鏇存柊!');  
             }  
          }  
        </script>
    </head>
    <body>
        <html:form action="/acctount" onsubmit="javascript:return Juge(this);">
            <input type="hidden" name="id"  value="<%=id%>">
            username : <html:text property="username" value="<%=Username %>" onblur="check(this)" />
<html:errors property="username"/><br/>
            password : <html:text property="password" value="<%=password %>"/>
<html:errors property="password"/><br/>

        <html:submit/><html:cancel/>
        </html:form>
    </body>
</html>




3:dwr.xml閰嶇疆
      <dwr>

    <allow> 
 
    
 <!-- 鐩存帴鍙栨搷浣滅被  <create creator="new" javascript="checkuser" scope="application">
      <param name="class" value="com.henry.dao.daospring"/>
       <include method="isExist"/>
    </create>
   -->
  
   <!-- 闂存帴鍙朾ean -->
       <create creator="spring" javascript="checkuser">
      <param name="beanName" value="accountDAO" />
         <include method="isExist"/>
         <include method="IsExistUpdate"/>
       </create>
 </allow> 
</dwr>

4:  applicationContext.xml

   <bean id="accountDAO" class="com.henry.dao.AccountDao">
   <property name="dataSource">
     <ref local="dataSource"/>
     </property>
    <property name="sqlMapClient">
    <ref bean="sqlMapClient"/>
    </property>
   
     </bean>
5:web.xml
   <servlet>
  <servlet-name>dwr-invoker</servlet-name>
  <display-name>DWR Servlet</display-name>
  <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
  <init-param>
     <param-name>debug</param-name>
     <param-value>true</param-value>
  </init-param>
</servlet>

<servlet-mapping>
  <servlet-name>dwr-invoker</servlet-name>
  <url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
 <context-param>
   <param-name>contextConfigLocation</param-name>
   <param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
   <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>


6:1)浠ヤ笂dwr閫氳繃闂存帴spring-> applicationContext.xml鐨刡ean
<!-- 闂存帴鍙朾ean -->
       <create creator="spring" javascript="checkuser">
      <param name="beanName" value="accountDAO" />
         <include method="isExist"/>
         <include method="IsExistUpdate"/>
       </create>


   2)濡傛灉鐩存帴鍙?span style="color: #ff0000;">spring-> applicationContext.xml鐨刡ean
<!-- 鐩存帴鍙栨搷浣滅被  <create creator="new" javascript="checkuser" scope="application">
      <param name="class" value="com.henry.dao.daospring"/>
       <include method="isExist"/>
    </create>
   -->
 
com.henry.dao.daospring
:濡備笅
package com.henry.dao;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import  com.henry.dto.accountDto;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
public class daospring {
    ApplicationContext context=new ClassPathXmlApplicationContext("com/henry/dbxml/applicationContext.xml");
    AccountDao testDAOImpl=(AccountDao)context.getBean("AccountDAO");
    public List getAccountsByName(String username)
    {
      
    
      return  testDAOImpl.getListByName(username);
    }
   
    /*
     * update check
     */
    public boolean IsExistUpdate(String username)
    {
        accountDto account=new accountDto();
        List list=this.getAccountsByName(username);
        if(list.size()==0)
        {
            return false;
        }
        else
        {
            //if(account.getId()==Integer.parseInt(id))
            //{
            //    return false;
               
            //}
            //else
            //{
                return true;
            //}
        }
    }
   
    public String getIdByName(String username,String id)
    {
        accountDto account=new accountDto();
        List list=this.getAccountsByName(username);
        if(list.size()==0)
        {
            return null;
        }
        else
        {
            return   Integer.toString(((accountDto)list.get(0)).getId()) ;
        }
       
    }
   
   
   
    public boolean IsExist(String username) { 
       
        if(testDAOImpl.isExist(username))
        {
        return true;
        }
        else
        {
            return false;
        }
      
   }
   
    //new or add   check
    public boolean isExist(String username) { 
          
        if(testDAOImpl.isExist(username))
        {
        return true;
        }
        else
        {
            return false;
        }
      
   }
   
   
    public accountDto getAccountById(String id)
    {
    return  testDAOImpl.getById(id);
    }
  
}


7:鍑虹幇闂struts---->action--->findforward璺寵漿欏甸潰------璇ラ〉闈wr鍙杝pring-->applicationContext.xml鐨刡ean鍙樻垚鏃犳晥

smallfa 2008-02-28 18:12 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 瑞昌市| 周口市| 横峰县| 富蕴县| 罗甸县| 博兴县| 文成县| 平陆县| 永安市| 浑源县| 南江县| 张家港市| 随州市| 西盟| 资溪县| 福州市| 盐源县| 和田县| 迁安市| 邢台市| 清苑县| 滨海县| 原阳县| 金乡县| 攀枝花市| 丰原市| 华池县| 大邑县| 南漳县| 上杭县| 彩票| 桐柏县| 潞西市| 新野县| 桦南县| 景谷| 抚州市| 阳西县| 武邑县| 临朐县| 清镇市|