SPRING-MVC and Jquery-easyui-layout Integration

Source: Internet
Author: User

Development Environment

Spring-webmvc - 4 . 0.8.RELEASE

jquery-easyui-1.4.0

These are the respective version numbers that are used to integrate the layout page.


Configuration
Spring-mvc.xml configuration


<?xml version= "1.0" encoding= "UTF-8"? ><beans xmlns= "Http://www.springframework.org/schema/beans" xmlns: context= "Http://www.springframework.org/schema/context" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" Xmlns:jee= "Http://www.springframework.org/schema/jee" xmlns:mvc= "Http://www.springframework.org/schema/mvc" xmlns:p= "http://www.springframework.org/schema/p" xsi:schemalocation= "http://www.springframework.org/schema/ Beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsdhttp://www.springframework.org/schema/ contexthttp://www.springframework.org/schema/context/spring-context-3.0.xsdhttp://www.springframework.org/ Schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsdhttp://www.springframework.org/schema/ MVC http://www.springframework.org/schema/mvc/spring-mvc.xsd "><mvc:annotation-driven/><!--Easyui style, JS configuration--><mvc:resources location= "/demo/" mapping= "/demo/**" ></mvc:resources><mvc:resources Location= "/locale/" Mapping= "/locale/**" ></mvc:resources><mvc:resources location= "/plugins/" mapping= "/demo/**" ></ Mvc:resources><mvc:resources location= "/themes/" mapping= "/themes/**" &GT;&LT;/MVC:RESOURCES&GT;&LT;MVC: Resources location= "/page/" mapping= "/page/**" ></mvc:resources><mvc:resources location= "/" mapping= "/* * "></mvc:resources></beans>

The important thing to note here is to configure the file header information within the
Http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd

This is mainly to cooperate with the following for the specific resource interception of MVC processing, or for the foreground JS and CSS and other resources are inaccessible.



Web. XML configuration


<?xml version= "1.0" encoding= "UTF-8"? ><web-app xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xmlns:web= "Http://xmlns.jcp.org/xml/ns/javaee" xsi:schemalocation= "Http://xmlns.jcp.org/xml/ns/javaee/http Java.sun.com/xml/ns/javaee/web-app_2_5.xsd "> <display-name>archetype Created Web application</ display-name> <context-param> <param-name>contextConfigLocation</param-name> <param-value >classpath*:applicationContext-*.xml</param-value> </context-param> <listener> < Listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener > <servlet> <servlet-name>action</servlet-name> <servlet-class>org.springframework.web . servlet. Dispatcherservlet</servlet-class> <init-param> <param-name>contextconfiglocation</ Param-name> <param-value>/WEB-INF/spring-mvc.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-na Me>action</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping></web-app >

In fact, this is mainly for the specific action of the relevant configuration, it is important to note that

schemalocation= "Http://xmlns.jcp.org/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
This configuration is mainly used to solve the foreground of the JSP to write the El expression to do the processing.



jsp configuration


<%@ page language= "java" import= "java.util.*" contenttype= "text/html"; Charset=utf-8 "pageencoding=" UTF-8 "%><!--enable El expression--><%@ page iselignored=" false "%><! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >
<span style= "color: #ff0000;" ><strong>1:<%@ page iselignored= "false"%></strong></span>


This is mostly used to enable the El expression to be written within the JSP.


<strong><span style= "color: #ff0000;" >2.${pageContext.request.contextPath}</span></strong>


This is primarily used to get the Web-side resource root directory.


Resource Page Read configuration


Add Tab Read Resource file


Here the demo is still using the actual JSP page, in fact, in the development process, each tab to increase the need to access or the respective resource file corresponding controller or published jndiname can be.

JS function

<script type= "Text/javascript" >/**   * Create a new tab   * @param tabId    tab ID   * @param title    tab title   * @param URL      tab Remote call path *  /function AddTab (tabid,title,url) {      //If the tab of the current ID does not exist then create a tab      if ($ ("#" +tabid). HTML () ==null) {          var name = ' Iframe_ ' +tabid;          $ (' #centerTab '). Tabs (' Add ', {              title:title,                       closable:true,              cache:false,              // Note: Use IFRAME to prevent JS and CSS conflicts on the same page              content: ' <iframe name= ' ' +name+ ' "id=" ' +tabid+ ' "src=" ' +url+ ' "width=" 100% "Height=" 100% "frameborder=" 0 "scrolling=" Auto "></iframe>"          });        

Configuration of the page


This is mainly based on the jquery definition of the class directly to use it.

!--the framework of the main interface--><body class= "Easyui-layout" ><!--Northern Area--><div data-options= "region: ' North ', border: False "style=" Height:60px;background: #B3DFDA;p adding:10px "> Test system </div><!--each module--><div data-options= "region: ' West ', Split:true,title: ' Functional index '" style= "width:150px;padding:10px;" ><!--Sub-modules: template management--><div class= "easyui-accordion" data-options= "Fit:true,border:false" > <div title= " Template Configuration "style=" padding:10px; " > <li><a href= "javascript:addtab (' tabid_templet ', ' template management ', ' templetmain.jsp ');" > Template Management </a></li> <li><a href= "Javascript:addtab (' Tabid_datagrid ', ' DataGrid template ', ' page/ Datagrid.jsp '); " >datagrid</a></li> </div></div></div><!--Eastern Region --><div data-options= "region: ' East ', split:true" style= "width:10px;padding:10px;" ></div><!--Bottom--><div data-options= "region: ' South ', Border:false" style= "Height:50px;background: #A9FACd;padding:10px; " ><div id= "Footer" >copyright &copy; TGB-9 Langfang Normal University information technology accelerated </div></div><!--Central layout--><div data-options= "region: ' Center '" fit= "True" border= "false" ><div class= "Easyui-tabs" id= "Centertab" fit= "true" border= "false" > <div ti tle= "Welcome page" style= "Padding:20px;overflow:hidden;" > <div style= "margin-top:20px;"          > 


Post

SPRING-MVC and Jquery-easyui-layout Integration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.