ExtDirectSpring的配置过程

1. 配置spring3MVC . 
需要在web.xml中加入spring的配置信息大致如下: 
<servlet> 
    <servlet-name>dispatcher</servlet-name> 
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
    <load-on-startup>1</load-on-startup> 
</servlet> 

2.配置映射关系 
<servlet-mapping> 
            <servlet-name>dispatcher</servlet-name> 
            <url-pattern>/dispatcher/*</url-pattern> 
</servlet-mapping> 

3.然后配置dispatcher-servlet.xml 
<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" 
xmlns:context="http://www.springframework.org/schema/context" 
xmlns:mvc="http://www.springframework.org/schema/mvc" 
xsi:schemaLocation=" 
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context-3.0.xsd 
http://www.springframework.org/schema/mvc 
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 
"> 
<context:component-scan base-package="ch.ralscha.extdirectspring"/> 
<!--默认的注解映射支持--> 
<mvc:annotation-driven /> 
<!--    
        <mvc:annotation-driven /> 
        会自动注册DefaultAnnotationHandlerMapping与AnnotationMethodHandlerAdapter 两个bean, 
        并提供了:数据绑定支持,@NumberFormatannotation支持,@DateTimeFormat支持,@Valid支持,读写XML的支持(JAXB),读写JSON的支持(Jackson)。 
        @Controller 声明Action组件 
        @Service    声明Service组件    
        @Repository 声明Dao组件 
        @Component   泛指组件, 当不好归类时. 
        @RequestMapping("/menu")  请求映射 
        @Resource  用于注入,( j2ee提供的 ) 默认按名称装配,@Resource(name="beanName") 
        @Autowired 用于注入,(srping提供的) 默认按类型装配 
        @Transactional( rollbackFor={Exception.class}) 事务管理 
        @ResponseBody 
        @Scope("prototype")   设定bean的作用域 
--> 

        <!--配置扫描路径--> 
       <context:component-scan base-package="controller" /> 


        <!--视图解释类--> 
       <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 
           <property name="prefix"> 
              <value>/</value> 
           </property> 
           <property name="suffix"> 
             <value>.jsp</value> 
           </property> 
      </bean> 

    <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> 
        <property name="basename" value="/WEB-INF/messages" /> 
    </bean> 

    <!-- Configure the multipart resolver --> 
    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">      
    </bean> 
</beans>	

4. 导入extdirectspring的jar包.在http://code.google.com/p/extdirectspring/downloads/list上下载 

在页面引入 
<script type="text/javascript" src="dispatcher/api-debug.js?groupe=reg"></script> 

至此配置完成
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值