Small and Medium Background System UI Framework--EasyUI

Background developers are not good at front-end UI interface, and small software companies do not have full-time artistic positions, developers can only use open source UI framework, reuse existing components, complete user interface. EasyUI is a collection of UI plug-ins based on jQuery, which can help developers build web pages easily.

Official address:

Reference to EasyUI

Download the EasyUI component jquery-easyui-1.*.*.zip on the official website, and import the project project project into the local folder, themes folder, jquery.easyui.min.js, jquery.min.js file.

2. Take the homepage of system user as an example, using EasyUI

1) User login system, home page interface


2) Coding design of home.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
    <head >
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>management system</title>    
    <link rel="stylesheet"  href="plugin/easyui/themes/icon.css" />
    <link rel="stylesheet"  href="plugin/easyui/themes/default/easyui.css" />
    <link rel="stylesheet" href="css/home.css"/>
    <script type="text/javascript" src="plugin/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="plugin/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="plugin/easyui/locale/easyui-lang-zh_CN.js"></script>
        <script type="text/javascript" src="js/pathurl.js"></script> 
    <script type="text/javascript" src="js/home.js?v=1.01"></script>
    <script type="text/javascript" src="js/head.js"></script>
    <!-- ${userName} -->
<body  class="easyui-layout" style="overflow-y: hidden"  scroll="no">
  <input id="logUser" type="hidden" value="${userName}"/>
  <input id="userNotice" type="hidden" value="${userNotice}"/>
<div region="north" split="true" border="false" style="overflow: hidden; height: 35px;
        background: url(images/header.jpg) #7f99be repeat-x center 50%;
        line-height: 30px;color: #fff; font-family: Verdana, Song Style ">
        <span style="padding-left:5px; font-size: 18px; ">management system</span> 
        <span style="float:right; padding-right:20px; font-size: 18px;" class="head">
        <a href="javascript:void(0)" id="menub" class="easyui-menubutton"     
    <div region="south" split="true" style="height: 30px; background: #D2E0F2; ">
      <div class="footer">Copyright © 2010-2017 Start, All rights reserved.</div>
<div region="west" hide="true" split="true" title="Navigation menu" style="width:180px;" id="west">
  <div id="menunav" class="easyui-accordion" fit="true" border="false"> 
    <!--  Navigation content --> 
<div id="mainPanle" region="center" style="background: #eee; overflow-y:hidden">
      <div id="tabs" class="easyui-tabs"  fit="true" border="false" >
    <div title="home page" style="padding:20px;overflow:hidden; color:blue; " >
          <h1 style="font-size:20px;" align="center">Welcome to use management system</h1>

<!--Modify password window-->
<div id="w" class="easyui-window" title="Change Password" collapsible="false" minimizable="false"
        maximizable="false" icon="icon-save"  style="width: 300px; height: 150px; padding: 5px;
        background: #fafafa;">
      <div class="easyui-layout" fit="true">
    <div region="center" border="false" style="padding: 10px; background: #fff; border: 1px solid #ccc;">
       <table cellpadding=3>
              <td>Old password:</td>
              <td><input id="txtOldPass" type="password" class="easyui-textbox" /></td>
              <td>New password:</td>
              <td><input id="txtNewPass" type="password" class="easyui-textbox" /></td>
              <td>Confirm password:</td>
              <td><input id="txtRePass" type="password" class="easyui-textbox" /></td>
    <div region="south" border="false" style="text-align: right; height: 30px; line-height: 30px;"> <a id="btnEp" class="easyui-linkbutton" icon="icon-ok" href="javascript:void(0)" > Determine</a> <a id="btnCancel" class="easyui-linkbutton" icon="icon-cancel" href="javascript:void(0)">cancel</a> </div>
<div id="mm" class="easyui-menu" style="width:150px;">
      <div id="mm-tabupdate">Refresh</div>
      <div class="menu-sep"></div>
      <div id="mm-tabclose">Close</div>
      <div id="mm-tabcloseall">close all</div>
      <div id="mm-tabcloseother">All of them are closed except for that.</div>
      <div class="menu-sep"></div>
      <div id="mm-tabcloseright">All the right side of the current page is closed</div>
      <div id="mm-tabcloseleft">All the left side of the current page is closed</div>
      <div class="menu-sep"></div>
      <div id="mm-exit">Sign out</div>
<div id="userfunc" style="width:150px;">   
    <div id="editpass" data-options="iconCls:'icon-edit'">Change Password</div>   
    <div id="loginOut"  data-options="iconCls:'icon-stop'">Cancellation</div>    

3) Write function menu UI according to easyUI component

$(function() { 

// Initialize the left menu
function InitLeftMenu() {

				animate : false

		url : "user/",
		type : "POST",
		dataType : "json",
		success : function(data) {
			console.log("Menu data: " + JSON.stringify(data));
			$.each(data.menus, function(i, n) {
						var menulist = '';
						menulist += '<ul>';
						$.each(n.menus, function(j, o) {
									menulist += '<li><div><a ref="'
											+ o.menuId
											+ '" href="#" rel="'
											+ o.menuUrl
											+ '" ><span class="icon '
											+ o.icon
											+ '"  > </span><span class="nav">'
											+ o.menuName
											+ '</span></a></div></li> ';

						menulist += '</ul>';

						$('#menunav').accordion('add', {
									title : n.menuName,
									content : menulist,
									iconCls : 'icon ' + n.icon

			$('.easyui-accordion li a').click(function() {
						var tabTitle = $(this).children('.nav').text();
						var url = $(this).attr("rel");
						var menuid = $(this).attr("ref");
						addTab(tabTitle, url);

						$('.easyui-accordion li div').removeClass("selected");
					}).hover(function() {
					}, function() {
			// Choose the first
			var panels = $('#menunav').accordion('panels');
			var t = panels[0].panel('options').title;
			$('#menunav').accordion('select', t);

// Add Tab
function addTab(subtitle, url) {
	if (!$('#tabs').tabs('exists', subtitle)) {
		$('#tabs').tabs('add', {
			title : subtitle,
			content : createFrame(url),
			closable : true
				// icon:icon
	} else {
		$('#tabs').tabs('select', subtitle);

// Open frame when creating click menu
function createFrame(url) {
	var s = '<iframe scrolling="auto" frameborder="0"  src="' + url
			+ '" style="width:100%;height:100%;"></iframe>';
	return s;

// Close the tab
function tabClose() {
	/* Double-click to close the TAB tab */
	$(".tabs-inner").dblclick(function() {
				var subtitle = $(this).children(".tabs-closable").text();
				$('#tabs').tabs('close', subtitle);
	/* Bind the right button for the tab */
	$(".tabs-inner").bind('contextmenu', function(e) {
				$('#mm').menu('show', {
							left : e.pageX,
							top : e.pageY

				var subtitle = $(this).children(".tabs-closable").text();

				$('#mm').data("currtab", subtitle);
				$('#tabs').tabs('select', subtitle);
				return false;
// Binding right-click menu events
function tabCloseEven() {
	// Refresh
	$('#mm-tabupdate').click(function() {
				var currTab = $('#tabs').tabs('getSelected');
				var url = $(currTab.panel('options').content).attr('src');
				$('#tabs').tabs('update', {
							tab : currTab,
							options : {
								content : createFrame(url)
	// Close the current
	$('#mm-tabclose').click(function() {
				var currtab_title = $('#mm').data("currtab");
				$('#tabs').tabs('close', currtab_title);
	// close all
	$('#mm-tabcloseall').click(function() {
				$('.tabs-inner span').each(function(i, n) {
							var t = $(n).text();
							$('#tabs').tabs('close', t);
	// Turn off TAB other than current
	$('#mm-tabcloseother').click(function() {
	// Close the current TAB on the right
	$('#mm-tabcloseright').click(function() {
				var nextall = $('.tabs-selected').nextAll();
				if (nextall.length == 0) {
					$.messager.alert('System hint', 'Closed', 'error');
					return false;
				nextall.each(function(i, n) {
							var t = $('a:eq(0) span', $(n)).text();
							$('#tabs').tabs('close', t);
				return false;
	// Close the current TAB on the left
	$('#mm-tabcloseleft').click(function() {
				var prevall = $('.tabs-selected').prevAll();
				if (prevall.length == 0) {
					return false;
				prevall.each(function(i, n) {
							var t = $('a:eq(0) span', $(n)).text();
							$('#tabs').tabs('close', t);
				return false;

	// Sign out
	$("#mm-exit").click(function() {

4) menu Json object data format

{"menus":[{"icon":null,"menuId":"A","menuName":"organizational management","menus":[{"menuId":"A1","menuName":"Departmental body","parentId":"A","menuUrl":"dept/","serialNo":null,"icon":null}]},{"icon":"icon-overview","menuId":"H","menuName":"system management","menus":[{"menuId":"H1","menuName":"user management","parentId":"H","menuUrl":"system/user/","serialNo":null,"icon":"icon-overview"},{"menuId":"H2","menuName":"Role management","parentId":"H","menuUrl":"system/role/","serialNo":null,"icon":"icon-overview"},{"menuId":"H3","menuName":"Menu management","parentId":"H","menuUrl":"system/menu/","serialNo":null,"icon":"icon-overview"},{"menuId":"H4","menuName":"Post member","parentId":"H","menuUrl":"system/rolemember/","serialNo":null,"icon":null},{"menuId":"H5","menuName":"system log","parentId":"H","menuUrl":"system/log/","serialNo":null,"icon":"icon-overview"},{"menuId":"H6","menuName":"data dictionary","parentId":"H","menuUrl":"system/param/","serialNo":null,"icon":"icon-overview"}]}]}

III. API Manual

1) Address of Official Web Components:

2) Chinese version of jQuery EasyUI official API document, download address:

Keywords: Javascript JQuery JSON Java

Added by djheru on Sun, 13 Oct 2019 17:07:32 +0300