DWR配置、and整合在spring!

    <!-- 
    <create creator="spring" javascript="dwrShowStyle" scope="page">
      <param name="class" value="com.fids.ssh.dao.showstyleDao"/>
      <include method="showStyleData"/>
    </create>
       -->
      
    <!-- convert标签是为了javascript可以调用有javabean参数的java方法 
    <convert converter="bean" match="com.fids.ssh.entity.Showstyle">
    </convert>
    -->

 上面是DWR.xml的配置,用于前台js来调用Service实现类

 

或者DWR整合spring,配置在spring中

<?xml version="1.0" encoding="UTF-8"?>
<!--
	配置系统基础环境
	showstyle模块
	author:cheney
 -->
<beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
     http://www.directwebremoting.org/schema/spring-dwr http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd">

                
	<bean id="showStyleDao" class="com.fids.ssh.showstyle.ShowStyleDaoImpl" parent="daoBase">
		<property name="hibernateTemplate" ref="hibernateTemplate"></property>
	</bean>
	<bean id="showStyleService" class="com.fids.ssh.showstyle.ShowStyleServiceImpl">
	    <property name="showStyleDao" ref="showStyleDao"></property>
	</bean>
	<bean id="showStyle" class="com.fids.ssh.showstyle.ShowStyleAction" scope="prototype" parent="actionBase">
		<property name="showStyleService" ref="showStyleService"></property>
	</bean>
	
   <!-- DWR配置 -->
    <dwr:configuration>
    	<!-- convert标签是为了javascript可以调用有javabean参数的java方法 -->
    	<dwr:convert type="bean" class="com.fids.ssh.entity.Showstyle"></dwr:convert>
    </dwr:configuration>
    <dwr:controller id="dwrController" debug="true" />
  
<!-- StyleDwrController 这个类算是个DWR控制类-->
    <bean id="ajax" class="com.fids.ssh.dwr.StyleDwrController">
        <dwr:remote javascript="dwrShowStyle">
            <dwr:include method="showStyleData" />
            <dwr:include method="addStyle"/>
        </dwr:remote>
        <property name="showStyleService" ref="showStyleService"></property>
    </bean>
	
	
</beans>

 

package com.fids.ssh.dwr;

import java.util.List;

import com.fids.ssh.entity.Showstyle;
import com.fids.ssh.showstyle.ShowStyleService;

public class StyleDwrController {

	private ShowStyleService showStyleService;
	
	/**
	 * 
	 * 读取样式信息
	 */
	public Showstyle showStyleData(String type){
		//........
                               return null;
	}
	
	public boolean addStyle(String htmlCode){
		//........		
                            return bflag;
	}

	public ShowStyleService getShowStyleService() {
		return showStyleService;
	}

	public void setShowStyleService(ShowStyleService showStyleService) {
		this.showStyleService = showStyleService;
	}
}

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值