zoukankan      html  css  js  c++  java
  • DWR Annotations 使用 SpringCreator

    For example:
    web.xml:
        <servlet>
            
    <servlet-name>dwr-invoker</servlet-name>
            
    <servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class>
            
    <init-param>
                
    <param-name>debug</param-name>
                
    <param-value>true</param-value>
            
    </init-param>
            
    <init-param>
                
    <param-name>classes</param-name>
                
    <param-value>
                    com.exjour.bean.people.UserBean,
                    com.exjour.bean.layer.WmsLayerBean,
                    com.exjour.web.handler.people.UserHandler,
                    com.exjour.web.handler.layer.WmsLayerHandler
                
    </param-value>
            
    </init-param>
        
    </servlet>

    WmsLayerHandler.java:
     1package com.exjour.web.handler.layer;
     2
     3import java.util.List;
     4
     5import org.directwebremoting.annotations.Param;
     6import org.directwebremoting.annotations.RemoteMethod;
     7import org.directwebremoting.annotations.RemoteProxy;
     8import org.directwebremoting.spring.SpringCreator;
     9
    10import com.exjour.bean.layer.WmsLayerBean;
    11import com.exjour.service.layer.WmsLayerService;
    12import com.exjour.web.handler.BaseHandler;
    13
    14@RemoteProxy(creator = SpringCreator.class,
    15    creatorParams = @Param(name = "beanName", value = "wmsLayerHandler"))
    16public class WmsLayerHandler extends BaseHandler {
    17
    18    private WmsLayerService wmsLayerService;
    19    
    20    public WmsLayerService getWmsLayerService() {
    21        return wmsLayerService;
    22    }

    23
    24    public void setWmsLayerService(WmsLayerService wmsLayerService) {
    25        this.wmsLayerService = wmsLayerService;
    26    }

    27
    28    @RemoteMethod
    29    public List<WmsLayerBean> getWmsLayerList() {
    30        return wmsLayerService.getWmsLayerList();
    31    }

    32}

    33
    其中绿色部分为Annotations,红色部分表示使用SpringCreator,粉色部分表示使用applicationContext中的"wmsLayerHandler" bean.

    WmsLayerBean.java:
    package com.exjour.bean.layer;

    import org.directwebremoting.annotations.DataTransferObject;
    import org.directwebremoting.annotations.RemoteProperty;

    @DataTransferObject
    public class WmsLayerBean {

        
    private int id;
        
    private String name;
        
    private boolean defaultVisiable;
        
    private String layers;
        
    private int state;
        
        @RemoteProperty
        
    public int getId() {
            
    return id;
        }

        
        
    public void setId(int id) {
            
    this.id = id;
        }

        
        @RemoteProperty
        
    public String getName() {
            
    return name;
        }

        
        
    public void setName(String name) {
            
    this.name = name;
        }

        
        @RemoteProperty
        
    public boolean isDefaultVisiable() {
            
    return defaultVisiable;
        }

        
        
    public void setDefaultVisiable(boolean defaultVisiable) {
            
    this.defaultVisiable = defaultVisiable;
        }

        
        @RemoteProperty
        
    public String getLayers() {
            
    return layers;
        }

        
        
    public void setLayers(String layers) {
            
    this.layers = layers;
        }

        
        @RemoteProperty
        
    public int getState() {
            
    return state;
        }

        
        
    public void setState(int state) {
            
    this.state = state;
        }

    }

  • 相关阅读:
    2015 ccpc 南阳国赛
    CF 812
    多校 2009 7
    2015 长春
    多校 2009 4
    selenium 对https网站(加密证书)进行自动化测试
    selenium配置
    2016.05.17开通自己的博客
    pod存在,但是deployment和statefulset不存在
    Eclipse设置代码格式化使用空格代替TAB
  • 原文地址:https://www.cnblogs.com/kylindai/p/1135286.html
Copyright © 2011-2022 走看看