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;
        }

    }

  • 相关阅读:
    http-server -S 开启 https 服务
    material-ui react的ui框架 有时间可以看看 chia用的前台ui
    关于vue.js:iview-Bug-5114在iview的Poptip气泡提示内调用DatePicker出现遮挡或同时关闭窗口等冲突问题[转]
    coding 的pages 静态要六分钱一个月,我也是醉了。
    jeesite 有时间看看
    选择单词后 按 ctrl + space 单词发音
    什么是CI/CD
    PostCSS深入学习: PostCSS和Sass、Stylus或LESS一起使用
    浅析requestAnimationFrame
    webpack性能优化
  • 原文地址:https://www.cnblogs.com/kylindai/p/1135286.html
Copyright © 2011-2022 走看看