Spring Boot + EasyUI 全屏布局(二)

一、创建一个Spring Boot + EasyUI项目

Spring Boot + EasyUI 创建第一个项目(一)_springboot整合easyui-CSDN博客

二、相关知识点总结

        布局(layout)是有五个区域(北区 north、南区 south、东区 east、西区 west 和中区 center)的容器。中间的区域面板是必需的,边缘区域面板是可选的。每个边缘区域面板可通过拖拽边框调整尺寸,也可以通过点击折叠触发器来折叠面板。布局(layout)可以嵌套,因此用户可建立复杂的布局。

布局(Layout)属性:

名称类型描述默认值
fitboolean当设置为 true 时,就设置布局(layout)的尺寸适应它的父容器。当在 'body' 标签上创建布局(layout)时,它将自动最大化到整个页面的全部尺寸。false
titlestring布局面板(layout panel)的标题文本。null
borderboolean当设置为 true 时,就显示布局面板(layout panel)的边框。true
splitboolean当设置为 true 时,就显示拆分栏,用户可以用它改变面板(panel)的尺寸。false

数据网格(DataGrid)属性:

三、项目举例

1 项目框架

2 代码实现

SpringBootMainApplication.java:

package com.xj.main;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

/**
 * @Author: xjfu
 * @Create: 2023/10/20 7:33
 * @Description: SpringBoot启动类
 */
@ComponentScan("com.xj")
@SpringBootApplication
public class SpringBootMainApplication {
    public static void main(String[] args) {
        try{
            SpringApplication.run(SpringBootMainApplication.class, args);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}

ThymeleafController.java:

package com.xj.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Author: xjfu
 * @Create: 2023/10/20 7:42
 * @Description:
 */
@RequestMapping("/easyui")
@Controller
public class ThymeleafController {

    @RequestMapping("/hello")
    public String sayHello(){
        //启动hello.html页面
        return "hello";
    }

    @RequestMapping("/helloPage")
    public String helloPage(){
        //启动helloPage.html页面
        return "helloPage";
    }

    //Datebox和Datetimebox案例
    @RequestMapping("/dateboxAndDatetimebox")
    public String dateboxAndDatetimebox(){
        //启动DateboxAndDatetimebox.html页面
        return "DateboxAndDatetimebox";
    }

    //流式布局
    @RequestMapping("/fullLayout")
    public String fluidLayout(){
        //启动fullLayout.html页面
        return "fullLayout";
    }
}

fullLayout.html:

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>全屏布局</title>
    <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../../themes/icon.css">
    <link rel="stylesheet" type="text/css" href="../demo.css">
    <script type="text/javascript" src="../../jquery.min.js"></script>
    <script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body class="easyui-layout">
    <div data-options="region:'north'" style="height:50px">北部</div>
    <div data-options="region:'south',split:true" style="height:50px;">南部</div>
    <div data-options="region:'east',split:true" title="East" style="width:150px;">东部</div>
    <div data-options="region:'west',split:true" title="West" style="width:13%;">西部</div>
    <div data-options="region:'center',title:'Main Title',iconCls:'icon-ok'">
        <table class="easyui-datagrid"
               data-options="method:'get',border:false,singleSelect:true,fit:true,fitColumns:true">
            <thead>
            <tr>
                <th data-options="field:'itemId'" width="80">Item ID</th>
                <th data-options="field:'productId'" width="100">Product ID</th>
                <th data-options="field:'price',align:'right'" width="80">Price</th>
                <th data-options="field:'unitCost',align:'right'" width="80">Unit Cost</th>
                <th data-options="field:'attribute'" width="150">Attribute</th>
                <th data-options="field:'status',align:'center'" width="150">Status</th>
            </tr>
            </thead>
            <tbody>
                <tr><td>1</td><td>product1</td><td>1.0</td><td>0.1</td><td>钱多</td><td>开心</td></tr>
                <tr><td>2</td><td>product2</td><td>2.0</td><td>0.2</td><td>话少</td><td>孤独</td></tr>
                <tr><td>3</td><td>product3</td><td>3.0</td><td>0.3</td><td>死的早</td><td>解脱</td></tr>
            </tbody>
        </table>
    </div>
</body>
</html>

pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.xj.study</groupId>
    <artifactId>SpringBootEasyUIStudyProject</artifactId>
    <version>1.0-SNAPSHOT</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.5</version>
        <relativePath/>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <!--Thymeleaf 启动器-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
    </dependencies>

    <!--build标签描述了如何来编译及打包项目,而具体的编译和打包工作是通过build中配置的 plugin 来完成-->
    <build>
        <plugins>
            <!--使用SpringBoot的打包插件-->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

3 运行结果

四、参考

1.Easyui Layout 布局_EasyUI 插件

2.Easyui Datagrid 数据网格_EasyUI 插件 

  • 8
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
MVC(Model-View-Controller)是一种软件设计模式,用于将应用程序的不同组成部分分离开来,以实现更好的代码组织、可维护性和重用性。 而EasyUI是一种基于jQuery的用户界面插件库,提供了许多用户界面组件和交互功能,使开发人员能够快速搭建富客户端应用程序。 SQL Server 2005是一种关系型数据库管理系统,提供了强大的数据管理和查询功能,可以用于存储和操作应用程序的数据。 对于MVC+EasyUI+SQL Server 2005的源代码,它可能是一个基于MVC架构的Web应用程序,使用了EasyUI来实现用户界面,通过SQL Server 2005来存储和管理数据。 具体而言,这个源代码可能包括以下内容: 1. 模型(Model)部分:负责定义数据结构和业务逻辑,可能包括与数据库的交互、数据验证和访问控制等。 2. 视图(View)部分:负责展示用户界面,可能包括使用EasyUI组件来创建交互式的界面元素,如表格、表单、对话框等。 3. 控制器(Controller)部分:负责响应用户交互事件,处理用户的请求并调用模型来获取或修改数据,然后更新视图展示给用户。 此外,源代码还可能包括数据库的设计和初始化脚本,用于创建数据库表和设置索引、约束等。 总之,MVC+EasyUI+SQL Server 2005的源代码可能是一个结合了分层架构、可视化界面和数据库管理的应用程序,通过使用这些技术和工具可以实现更好的代码组织和开发效率,以及更好的用户体验和数据管理能力。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值