日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

OpenCMS integration with Spring MVC--reference

發布時間:2025/4/5 javascript 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 OpenCMS integration with Spring MVC--reference 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

ref from:http://blogs.indrajitpingale.com/?p=8

http://blog.shinetech.com/2013/04/09/integrating-springmvc-with-opencms/

It is assumed that you have successfully deploted OpenCMS 8.x on either Tomcat or JBoss (How to deploy OpenCMS on JBoss?). Also, it is assumed that your are hands-on on Spring MVC.


So there are 6 part of Spring MVC application.

?

  • classes (Controllers and other)
  • JSP files
  • Assets (image, js, css and other files)
  • Spring taglibs (spring-form.tld,?spring.tld) *** if any ***
  • Servlet configuration files (xxxx-servlet.xml)
  • libs (your application might need more or less)
  • aopalliance-1.0.jar ? ? ? ? ? ? ? ? ? ??
  • ehcache-1.2.3.jar ? ? ? ? ? ? ? ? ? ? ??
  • hibernate-3.2.3.ga.jar ? ? ? ? ? ? ? ? ?
  • log4j-1.2.17.jar ? ? ? ? ? ? ? ? ? ? ? ?
  • opencmsspring_c3p0-0.9.1-pre5a.jar ? ? ?
  • opencmsspring_hibernate3.2.jar ? ? ? ? ?
  • rapid-web.jar ? ? ? ? ? ? ? ? ? ? ? ? ??
  • spring-aop-3.0.5.RELEASE.jar ? ? ? ? ? ?
  • spring-asm-3.0.5.RELEASE.jar ? ? ? ? ? ?
  • spring-beans-3.0.5.RELEASE.jar ? ? ? ? ?
  • spring-context-3.0.5.RELEASE.jar ? ? ? ?
  • spring-context-support-3.0.5.RELEASE.jar
  • spring-core-3.0.5.RELEASE.jar ? ? ? ? ??
  • spring-expression-3.0.5.RELEASE.jar ? ??
  • spring-jdbc-3.0.5.RELEASE.jar ? ? ? ? ??
  • spring-orm-3.2.3.RELEASE.jar ? ? ? ? ? ?
  • spring-tx-3.0.5.RELEASE.jar ? ? ? ? ? ??
  • spring-web-3.0.5.RELEASE.jar ? ? ? ? ? ?
  • spring-webmvc-3.0.5.RELEASE.jar ? ? ? ??
  • web.xml

  • Steps to deploy Spring MVC application in openCMS.

  • Copy all libs to “opencms.war\WEB-INF\lib” folder.
  • Copy *.tld, xxxx-servlet.xml, xxxx-service.xml to “opencms.war\WEB-INF” folder.
  • Create .jar of your classes (only classes nothing else) and copy it to “opencms.war\WEB-INF\lib” folder.
  • Now the tricky part is web.xml,?don’t copy?it to?”opencms.war\WEB-INF” otherwise it will overwrite openCMS’s web.xml. Follow the following steps.
  • Open openCMS’s web.xml (opencms.war\WEB-INF\web.xml) for edit.
  • 1st copy following

    ?

    ?
    <!-- Begin: OpenCmsSpring Integration -->??? <context-param>? ???<param-name>contextConfigLocation</param-name>? ???<param-value>/WEB-INF/OpenCmsSpring-service.xml</param-value>? </context-param>?? <filter>? ???<filter-name>CharacterEncoding</filter-name>? ???<filter-class>? ????????org.springframework.web.filter.CharacterEncodingFilter? ???</filter-class>? ???<init-param>? ????????<param-name>encoding</param-name>? ????????<param-value>UTF-8</param-value>? ???</init-param>? ???<init-param>? ????????<param-name>forceEncoding</param-name>? ????????<param-value>true</param-value>? ???</init-param>? </filter>??? <!-- End: OpenCmsSpring Integration -->


    under following

    ?
    <context-param>? ??<param-name>DefaultWebApplication</param-name>? ??<param-value>ROOT</param-value>? </context-param>
  • 2nd?copy following? ?
    <!-- Begin: OpenCmsSpring Integration -->??? <listener>? ????<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>? </listener>???? <servlet>? ????<servlet-name>OpenCmsSpring</servlet-name>? ????<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>? ????<load-on-startup>1</load-on-startup>? </servlet>? <!-- End: OpenCmsSpring Integration -->


    under following

    ?
    <listener>? ????<listener-class>org.opencms.main.OpenCmsListener</listener-class>? </listener>
  • 3rd copy following to redirect spring request to?RewriteFilter. ?
    <!-- Begin: OpenCmsSpring Integration -->? <servlet-mapping>? ????<servlet-name>OpenCmsSpring</servlet-name>? ????<url-pattern>*.htm</url-pattern>? </servlet-mapping>? <filter>? ????<filter-name>RewriteFilter</filter-name>? ????<filter-class>com.ipingale.filter.RewriteFilter</filter-class>? </filter>? <filter-mapping>? ????<filter-name>RewriteFilter</filter-name>? ????<url-pattern>/*</url-pattern>? </filter-mapping>? <filter-mapping>? ????<filter-name>CharacterEncoding</filter-name>? ????<url-pattern>/*</url-pattern>? </filter-mapping>??? <!-- End: OpenCmsSpring Integration -->


    under following

    ?
    <servlet-mapping>? ????<servlet-name>OpenCmsWebDavServlet</servlet-name>? ????<url-pattern>/webdav/*</url-pattern>? </servlet-mapping>
  • 4th and last copy following to add support to spring Taglibs

    ?

    ?
    <!-- Begin: Spring Integration -->? <taglib>? ????<taglib-uri>/spring</taglib-uri>? ????<taglib-location>/WEB-INF/spring.tld</taglib-location>? </taglib>? <taglib>? ????<taglib-uri>/form</taglib-uri>? ????<taglib-location>/WEB-INF/spring-form.tld</taglib-location>? </taglib>?? <!-- End: Spring Integration -->


    under following

    ?
    <taglib>? ????<taglib-uri>http://www.opencms.org/taglib/cms</taglib-uri>? ????<taglib-location>/WEB-INF/opencms.tld</taglib-location>? </taglib>
  • Now start Tomcat/JBoss.
  • Open openCMS dashboard (http://localhost:8080/opencms/opencms/system/login/).
  • Create any site (folder) inside site/default for e.g. “demo1″.
  • Upload all JSP files under this folder (site/default/demo1).
  • Now about Assets. Where to put those in openCMS?
  • For that create Module from Administrator view (with name “com.ipingale.demo.module”).
  • Add resource folder to that module.
  • Copy all Assets under that folder.
  • Touch ups.
  • Assets links, e.g. css, js, images, etc. referred in JSP. You need to modify them as follows.
    Before:

    ?

    ?
    <link href="css/style.css" rel="stylesheet" type="text/css" />

    After:

    ?
    <link href="<cms:link>/system/modules/com.ipingale.demo.module/resources/css/style.css</cms:link>" rel="stylesheet" type="text/css" />
  • To support “” you need to add following on the top of each JSP page. ?
    <%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
  • Rename all .jsp files to .spg (or anything other than known mime types).
  • That’s it you are ready now.

    Click on your start page (index.spg) and here you go.

    ?

    You can download working example from below location.

    https://drive.google.com/file/d/0B3Qu76R8MDYwclFWQV9Da3JqMDQ/edit?usp=sharing

    Or

    http://www.sendspace.com/file/x2sipm

    ?

    References:

    http://blog.shinetech.com/2013/04/09/integrating-springmvc-with-opencms/

    http://opencms.996256.n3.nabble.com/OpenCms-and-Spring-MVC-preview-and-direct-edit-of-resources-td22555.html

    ?

    Thanks to?Mathias Lin !!!

    This entry was posted in?OpenCMS,?Spring-MVC?on?February 4, 2014.

    轉載于:https://www.cnblogs.com/davidwang456/p/3663357.html

    總結

    以上是生活随笔為你收集整理的OpenCMS integration with Spring MVC--reference的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。