欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Java在各种框架下编译Scala 【二】 Java框架ScalawicketSpring

程序员文章站 2022-07-15 15:14:27
...

     

    web.xml中设置

    接下来,修改main/webapp/WEB-INF/web.xml。从而确立了Wicket的过滤器,打开Spring的JPA实体管理器和Spring监听器,进行Spring的初始化。

  1.  <?xml version="1.0" encoding="UTF-8"?>          
  2. <web-app version="3.0"xmlns="http://java.sun.com/xml/ns/javaee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"           
  3.            
  4.          xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">           
  5.      <filter>          
  6.            
  7.          <filter-name>f2</filter-name>          
  8.         <filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>           
  9.            
  10.     </filter>           
  11.     <filter>           
  12.          <filter-name>f1</filter-name>          
  13.         <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>           
  14.            
  15.          <init-param>          
  16.             <param-name>applicationClassName</param-name>           
  17.            
  18.             <param-value>com.foo.myapp.MyApp</param-value>           
  19.          </init-param>          
  20.            
  21.     </filter>           
  22.     <filter-mapping>           
  23.         <filter-name>f1</filter-name>           
  24.         <url-pattern>/app/*</url-pattern>           
  25.     </filter-mapping>           
  26.     <filter-mapping>           
  27.         <filter-name>f2</filter-name>           
  28.         <url-pattern>/*</url-pattern>           
  29.     </filter-mapping>           
  30.     <context-param>           
  31.         <param-name>contextConfigLocation</param-name>           
  32.         <param-value>classpath:/beans.xml</param-value>           
  33.     </context-param>           
  34.     <listener>           
  35.         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>           
  36.      </listener>          
  37.            
  38. </web-app>