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" parent="daoBase"><property name="hibernateTemplate" ref="hibernateTemplate"></property></bean><bean id="showStyleService" ref="showStyleDao"></property></bean><bean id="showStyle" scope="prototype" parent="actionBase"><property name="showStyleService" ref="showStyleService"></property></bean> <!-- DWR配置 --> <dwr:configuration> <!-- convert标签是为了javascript可以调用有javabean参数的java方法 --> <dwr:convert type="bean" debug="true" />
<!-- StyleDwrController 这个类算是个DWR控制类--> <bean id="ajax" /> <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;}}?
?
?