struts2.0,spring2.5,hibernate3.0,dwr3.0.

web.xml

<?xml version="1.0" encoding="UTF-8"?>  
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">  
      <welcome-file-list>  
        <welcome-file>index.jsp</welcome-file>  
      </welcome-file-list>  
       <context-param>  
           <param-name>contextConfigLocation</param-name>  
           <param-value>classpath:applicationContext.xml</param-value>  
        </context-param>  
      <!-- 对spring容器进行实例化 -->  
        <listener>  
              <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>  
        </listener>  
      <filter>  
        <filter-name>struts2</filter-name>  
         <filter-class>org.apache.struts2.dispatcher.Filterdispatcher</filter-class>  
      </filter>  
      <filter-mapping>  
            <filter-name>struts2</filter-name>  
            <url-pattern>/*</url-pattern>  
       </filter-mapping>  
        **<servlet>  
        <!-- 指定DWR核心Servlet的名字 -->  
           <servlet-name>dwr-invoker</servlet-name>  
           <servlet-class>  
        <!-- 指定DWR核心Servlet的实现类 -->  
        <!-- org.directwebremoting.servlet.DwrServlet -->  
            org.directwebremoting.spring.DwrSpringServlet     

           </servlet-class>  
        <!-- 指定DWR核心Servlet处于调试状态 -->  
           <init-param>  
            <param-name>debug</param-name>  
            <param-value>true</param-value>  
           </init-param>  
           <load-on-startup>1</load-on-startup>  
        </servlet>  
        <!-- 指定核心Servlet的URL映射 -->  
        <servlet-mapping>  
           <servlet-name>dwr-invoker</servlet-name>  
           <url-pattern>/cyq/*</url-pattern>  
        </servlet-mapping>**  
    </web-app>

dwr.xml

<?xml version="1.0" encoding="UTF-8"?>  
    <!DOCTYPE dwr PUBLIC "-//GetAhead Limited//DTD Direct Web Remoting 3.0//EN" "http://getahead.org/dwr/dwr30.dtd">  

    <dwr>  
        <allow>  
            <create creator="spring" javascript="menuSelect" >  

                <param name="beanName" value="com.action.MyAction" />  
            </create>  

            <convert converter="bean" match="com.beans.Menu" />  
        </allow>  

    </dwr>

注意:dwr.xml的 要与页面引入的js文件名一致,比如,切要与spring配置文件里的标签引入的js名一致,见如下的配置。

beans.xml

<?xml version="1.0" encoding="UTF-8"?>  
    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.directwebremoting.org/schema/spring-dwr http://www.directwebremoting.org/schema/spring-dwr-3.0.xsd">  

        <context:annotation-config />  
         <!-- DWR 配置开始 -->     

       <dwr:configuration></dwr:configuration><!-- 必须要configuration -->       
        <dwr:controller id="dwrController" debug="true" />       
       <!-- DWR 配置结束 -->            

        <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">  
            <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />  
            <property name="url" value="jdbc:oracle:thin:@172.16.40.132:1521:localorc" />  
            <property name="username" value="hr" />  
            <property name="password" value="hr" />  
             <!-- 连接池启动时的初始值 -->  
            <property name="initialSize" value="1" />  
             <!-- 连接池的最大值 -->  
            <property name="maxActive" value="500" />  
             <!-- 最大空闲值.当经过一个高峰时间后,连接池可以慢慢将已经用不到的连接慢慢释放一部分,一直减少到maxIdle为止 -->  
            <property name="maxIdle" value="2" />  
             <!-- 最小空闲值.当空闲的连接数少于阀值时,连接池就会预申请去一些连接,以免洪峰来时来不及申请 -->  
            <property name="minIdle" value="1" />  
        </bean>  
        <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionfactorybean">  
            <property name="dataSource" ref="dataSource" />  
            <property name="mappingResources">  
                <list>  
                    <value>com/lc/domain/operator.hbm.xml</value>  
                </list>  
            </property>  
            <property name="hibernateProperties">  
                <value>  
                    hibernate.dialect=org.hibernate.dialect.Oracle9Dialect  
                    hibernate.hbm2ddl.auto=update  
                    hibernate.show_sql=false  
                    hibernate.format_sql=false  
                    hibernate.cache.use_second_level_cache=true  
                    hibernate.cache.use_query_cache=false  
                    hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider  
                  </value>  
            </property>  
        </bean>  
        <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">  
            <property name="sessionFactory" ref="sessionFactory" />  
        </bean>  
        <tx:annotation-driven transaction-manager="txManager" />  
        <bean id="opeDaoImp" class="com.lc.dao.imp.OperatorDaoImp">  
            <property name="sessionFactory">  
                <ref bean="sessionFactory"/>  
            </property>  
        </bean>  
        <bean id="loginAction" class="com.lc.action.OperatorAction">  
            <property name="opeDao">  
                <ref bean="opeDaoImp"/>  
            </property>    
            <dwr:remote javascript="login"></dwr:remote>   
        </bean>  

    </beans>

JSP页面:

<%@ page language="java" import="java.util.*" pageEncoding="utf-8" contentType="text/html; charset=utf-8"%>
<% String path = request.getcontextpath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'EnterGroup.jsp' starting page</title>

<Meta http-equiv="pragma" content="no-cache">
<Meta http-equiv="cache-control" content="no-cache">
<Meta http-equiv="expires" content="0">
<Meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<Meta http-equiv="description" content="This is my page">

<script type='text/javascript' src='cyqdwr/engine.js'></script>
<script type='text/javascript' src='cyqdwr/util.js'></script>
<script type='text/javascript' src='cyqdwr/interface/menuSelect.js'></script>
<script type="text/javascript"> var i = 1; function addRow() { var tdValue = document.getElementById("td1").firstChild.nodeValue; var oTab = document.getElementById("myTab"); var oTr = document.createElement('tr');//创建一个tr //创建第一个td var otd = document.createElement('td'); otd.innerHTML = tdValue; oTr.appendChild(otd);//将td插入tr //创建第二个td var otd = document.createElement('td'); otd.innerHTML = "<input type='text' name='menus.groupName'>"; oTr.appendChild(otd);//将td插入tr oTab.tBodies[0].appendChild(oTr);//将整个tr插入到表格中 i++; } </script>
 <script type="text/javascript"> function flashSel(){ menuSelect.flushMenu(); } </script>
</head>

<body onload="dwr.engine.setActiveReverseAjax(true),flashSel();">
    <span>菜单录入界面</span>
    <form action="Enter_addMenu" method="get">
        <table id="myTab">
            <tr>
                <td id="td1">菜单名称</td>
                <td><input type="text" name="menus.menuName"></td>
            </tr>
            <tr>
                <td id="td1">菜单URL</td>
                <td><input type="text" name="menus.menuURL"></td>
            </tr>
            <tr>
                <td id="td1">父菜单</td>
                <td><select id="menuSelect">

                </select> <input type="text" name="menus.menu"></td>
            </tr>
        </table>
        <input type="button" value="增加菜单" onclick="addRow()"> <input  type="submit" value="录入" onclick="sub()">
    </form>
</body>
</html>

dwr整合ssh的xml配置方式的更多相关文章

  1. HTML5 WebSocket实现点对点聊天的示例代码

    这篇文章主要介绍了HTML5 WebSocket实现点对点聊天的示例代码的相关资料,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧

  2. xcode – Cordova plugin.xml添加“Header Search Paths”条目

    我希望将Cordova插件添加到Xcode项目后,在“HeaderSearchPaths”下添加一个新条目.如何在Cordovaplugin.xml文件中进行配置?

  3. ios – 有关多个连接/提要/视图的XML解析的设计/实现建议

    >我应该在每个视图中都有解析器类/对象或解析XML提要吗?

  4. osx – 无法创建目录/ var / teamsserver

    OpenSSH_6.2p2,OSSLShim0.9.8r8Dec2011debug1:Readingconfigurationdata/etc/ssh_configdebug1:/etc/ssh_configline20:Applyingoptionsfor*debug1:Connectingto1.2.3.4[1.2.3.4]portPORT.debug1:Connectionestablished.Couldnotcreatedirectory‘/var/teamsserver/.ssh’.debug

  5. ios – Xcode Server 4.0 git从构建触发脚本推送

    我为一个托管在github上的项目安装了一个XcodeBot.我按照步骤和设置机器人来使用我现有的SSH密钥.验证成功,项目结算和建立.然后,我在预触发器操作中添加了一个shell脚本,它增加了plist中的版本,将其标记,并将该更改提交到github.但是当我尝试从shell脚本执行gitpush时,我得到:–推送到git@github.com:spex-app/spex-ios.git权限被拒

  6. iOS的相当于Android的colors.xml的是什么?

    如果没有,组织整个应用程序使用的颜色的最佳方法是什么?

  7. iOS中的XML转换为JSON

    我需要将XML响应转换为JSON.我的XML响应:我正在使用本网站的XMLReader支持文件:XMLReader我正在使用此代码将XML转换为JSON我收到了JSON响应:我需要这样的回应:我在线转换时得到这个回应.如何获得这样的回应提前致谢.解决方法此代码不会将任何内容转换为JSON.它给你一个NSDictionary.您需要从字典中实际创建JSON数据.尝试这个大小.

  8. ios – Xcode上传错误:无法打开ssh会话. (16)

    注意:我们终于上传了该应用程序,但是我们并没有真正解决这个问题,所以如果有人可以分享一些有关这个问题的宝贵意见或经验,我将不胜感激.我也检查了以下2个类似的问题,但这些没有帮助:>Erroruploadingiosapplicationtoitunesconnect“failedtoopensshsession(16)”>AppStoresubmission/distributionerror“f

  9. ios – Info.plist格式不正确

    解决方法plist文件是严格指定格式的XML文档;XML和PropertyList结构都有非常严格的规则.如果您尝试手动编辑info.plist(即文本),您可以轻松搞砸事情,方法是打开Asas>源代码:您不太可能正确使用此格式.因此,您应该始终使用OpenAs>编辑info.plist.物业清单:这允许属性列表编辑器为您生成XML,并且不太可能在生成的XML结构中出错.当然,我想你仍然可能搞砸某些东西的价值……

  10. ios – 在没有XML的情况下更新sqlite数据库

    我的应用程序需要来自sqlite数据库的数据.它将附带此数据库的一个版本,但我需要定期更新它(很可能每月一次).通常情况下,我一直在通过我设置的一堆网络服务将我的应用程序的其他部分的更新作为XML发送,但我现在正在处理的这个特定数据库非常大(大约20-30MB),而且我当我尝试以这种方式发送时出现超时错误.我尝试将数据库放在我的公司服务器上,然后将其下载到NSData对象中.然后我将该数据对象保存

随机推荐

  1. xe-ajax-mock 前端虚拟服务

    最新版本见Github,点击查看历史版本基于XEAjax扩展的Mock虚拟服务插件;对于前后端分离的开发模式,ajax+mock使前端不再依赖后端接口开发效率更高。CDN使用script方式安装,XEAjaxMock会定义为全局变量生产环境请使用xe-ajax-mock.min.js,更小的压缩版本,可以带来更快的速度体验。

  2. vue 使用 xe-ajax

    安装完成后自动挂载在vue实例this.$ajaxCDN安装使用script方式安装,VXEAjax会定义为全局变量生产环境请使用vxe-ajax.min.js,更小的压缩版本,可以带来更快的速度体验。cdnjs获取最新版本点击浏览已发布的所有npm包源码unpkg获取最新版本点击浏览已发布的所有npm包源码AMD安装require.js安装示例ES6Module安装通过Vue.use()来全局安装示例./Home.vue

  3. AJAX POST数据中文乱码解决

    前端使用encodeURI进行编码后台java.net.URLDecoder进行解码编解码工具

  4. Koa2框架利用CORS完成跨域ajax请求

    实现跨域ajax请求的方式有很多,其中一个是利用CORS,而这个方法关键是在服务器端进行配置。本文仅对能够完成正常跨域ajax响应的,最基本的配置进行说明。这样OPTIONS请求就能够通过了。至此为止,相当于仅仅完成了预检,还没发送真正的请求呢。

  5. form提交时,ajax上传文件并更新到&lt;input&gt;中的value字段

  6. ajax的cache作用

    filePath="+escape;},error:{alert;}});解决方案:1.加cache:false2.url加随机数正常代码:网上高人解读:cache的作用就是第一次请求完毕之后,如果再次去请求,可以直接从缓存里面读取而不是再到服务器端读取。

  7. 浅谈ajax上传文件属性contentType = false

    默认值为contentType="application/x-www-form-urlencoded".在默认情况下,内容编码类型满足大多数情况。在这里,我们主要谈谈contentType=false.在使用ajax上传文件时:在其中先封装了一个formData对象,然后使用post方法将文件传给服务器。说到这,我们发现在JQueryajax()方法中我们使contentType=false,这不是冲突了吗?这就是因为当我们在form标签中设置了enctype=“multipart/form-data”,

  8. 909422229_ajaxFileUpload上传文件

    ajaxFileUpload.js很多同名的,因为做出来一个很容易。我上github搜AjaxFileUpload出来很多类似js。ajaxFileUpload是一个异步上传文件的jQuery插件传一个不知道什么版本的上来,以后不用到处找了。语法:$.ajaxFileUploadoptions参数说明:1、url上传处理程序地址。2,fileElementId需要上传的文件域的ID,即的ID。3,secureuri是否启用安全提交,默认为false。4,dataType服务器返回的数据类型。6,error

  9. AJAX-Cache:一款好用的Ajax缓存插件

    原文链接AJAX-Cache是什么Ajax是前端开发必不可少的数据获取手段,在频繁的异步请求业务中,我们往往需要利用“缓存”提升界面响应速度,减少网络资源占用。AJAX-Cache是一款jQuery缓存插件,可以为$.ajax()方法扩展缓存功能。

  10. jsf – Ajax update/render在已渲染属性的组件上不起作用

    我试图ajax更新一个有条件渲染的组件。我可以确保#{user}实际上是可用的。这是怎么引起的,我该如何解决呢?必须始终在ajax可以重新呈现之前呈现组件。Ajax正在使用JavaScriptdocument.getElementById()来查找需要更新的组件。但是如果JSF没有将组件放在第一位,那么JavaScript找不到要更新的内容。解决方案是简单地引用总是渲染的父组件。

返回
顶部