search
HomeJavajavaTutorialExample analysis: statistical information management, Spring annotation development and EasyUI

Author: kentpeng

Please indicate the source for reprinting:

1. Statistical information management

 

二、Spring annotation development

 1.Service is an example

@Service("customerService")
@Transactional(isolation=Isolation.REPEATABLE_READ,propagation=Propagation.REQUIRED,readOnly=false)public class CustomerServiceImpl implements CustomerService {
    @Resource(name="customerDao")private CustomerDao cd;

三、EasyUI

 1.Develop for enterprises Eliminate the art front-end. Comes with a set of page styles and effects.

Use fastjson-1.2.8.jar for json.

Mainly refer to the documentation and examples for development. The following is an example of adding, deleting, modifying and checking:

 

  Code:

nbsp;html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><meta><title>客户信息管理</title><link><link><script></script><script></script><script></script><script>//点击提交按钮触发该方法提交表单
function submitForm(){
// submit the form    
$(&#39;#ff&#39;).submit();  
}

        $(function(){
            //-------------------------------------------------------------------------
            $(&#39;#w&#39;).window(&#39;close&#39;); //页面加载完成,确保窗口关闭
            //-------------------------------------------------------------------------
            $(&#39;#ff&#39;).form({    
                url:&#39;${pageContext.request.contextPath}/UserAction_regist&#39;,    
                onSubmit: function(){    
                    // do some check    
                    // return false to prevent submit; 
                    return true;//让表单直接提交
                },    
                success:function(data){ //提交成功后调用的方法  
                    $(&#39;#w&#39;).window(&#39;close&#39;);//提交成功关闭窗口
                    $(&#39;#test&#39;).datagrid(&#39;reload&#39;); //提交成功,重新加载列表数据   
                    $(&#39;#ff&#39;).form(&#39;clear&#39;);//提交成功后,清空表单
                }    
            });  
        
            
            //--------------------------------------------------------------------------
            $(&#39;#test&#39;).datagrid({
                title:&#39;用户列表&#39;, //表格标题
                singleSelect:true, //只允许单选
                iconCls:&#39;icon-tip&#39;,//表格标题图标
                //width:700, //宽度
                //height:350, //高度
                nowrap: true,//某列数据较长时,是否需要换行
                striped: true,//是否隔行变色
                collapsible:false,//是否可以折叠表格
                url:&#39;${pageContext.request.contextPath}/UserAction_list&#39;,//指定表格数据加载的路径
                sortName: &#39;user_id&#39;,//指定可以使用哪列进行排序
                sortOrder: &#39;desc&#39;,//指定默认排序规则 asc/desc
                remoteSort: false,//是否支持远程
                idField:&#39;user_id&#39;, //那一列是id列
                frozenColumns:[[
                    {field:&#39;ck&#39;,checkbox:true},
                    {title:&#39;用户id&#39;,field:&#39;user_id&#39;,width:80,sortable:true}
                ]],
                columns:[[
                    {field:&#39;user_name&#39;,title:&#39;用户名&#39;,width:120},
                    {field:&#39;user_code&#39;,title:&#39;登录名&#39;,width:220}
                ]],
                pagination:true,
                rownumbers:true,
                toolbar:[{ //配置工具栏
                    id:&#39;btnadd&#39;,
                    text:&#39;添加用户&#39;,
                    iconCls:&#39;icon-add&#39;,
                    handler:function(){
                        $(&#39;#btnsave&#39;).linkbutton(&#39;enable&#39;);
                        //打开前清空表单
                        $(&#39;#ff&#39;).form(&#39;clear&#39;);
                        //打开表单窗口
                        $(&#39;#w&#39;).window(&#39;open&#39;);
                    }
                },{
                    id:&#39;btncut&#39;,
                    text:&#39;修改用户&#39;,
                    iconCls:&#39;icon-cut&#39;,
                    handler:function(){
                        $(&#39;#btnsave&#39;).linkbutton(&#39;enable&#39;);
                        //获得被选中的用户的id
                        var user_id = getSelected();
                        
                        if(!user_id){
                            alert("请选择用户!");
                            return;
                        }
                        //根据id回显数据
                        $(&#39;#ff&#39;).form(&#39;load&#39;,&#39;${pageContext.request.contextPath}/UserAction_toEdit?user_id=&#39;+user_id);
                        //清空密码输入框
                        
                        //打开编辑窗口
                        $(&#39;#w&#39;).window(&#39;open&#39;);
                    
                    }
                },&#39;-&#39;,{
                    id:&#39;btnsave&#39;,
                    text:&#39;删除用户&#39;,
                    disabled:false, //禁用属性
                    iconCls:&#39;icon-save&#39;,
                    handler:function(){
                        $(&#39;#btnsave&#39;).linkbutton(&#39;enable&#39;);//点击后按钮是否可以继续点击
                        //获得被选中的用户id
                        //获得被选中的用户的id
                        var user_id = getSelected();
                        //判断id不能为空
                        if(!user_id){
                            alert("请选择用户!");
                            return;
                        }
                        //调用ajax异步发送请求删除用户
                        $.get("${pageContext.request.contextPath}/UserAction_delete?user_id="+user_id, function(data){
                                //删除成功后,刷新列表
                             $(&#39;#test&#39;).datagrid(&#39;reload&#39;); //提交成功,重新加载列表数据   
                            });
                    }
                }]
            });
            var p = $(&#39;#test&#39;).datagrid(&#39;getPager&#39;);
            $(p).pagination({
                onBeforeRefresh:function(){
                    alert(&#39;before refresh&#39;);
                }
            });
        });
        function resize(){
            $(&#39;#test&#39;).datagrid(&#39;resize&#39;, {
                width:700,
                height:400
            });
        }
        //获得被选中的
        function getSelected(){
            var selected = $(&#39;#test&#39;).datagrid(&#39;getSelected&#39;);
            if (selected){
                return selected.user_id;
            }
        }
        function getSelections(){
            var ids = [];
            var rows = $(&#39;#test&#39;).datagrid(&#39;getSelections&#39;);
            for(var i=0;i<rows.length;i++){
                ids.push(rows[i].code);
            }
            alert(ids.join(&#39;:&#39;));
        }
        function clearSelections(){
            $(&#39;#test&#39;).datagrid(&#39;clearSelections&#39;);
        }
        function selectRow(){
            $(&#39;#test&#39;).datagrid(&#39;selectRow&#39;,2);
        }
        function selectRecord(){
            $(&#39;#test&#39;).datagrid(&#39;selectRecord&#39;,&#39;002&#39;);
        }
        function unselectRow(){
            $(&#39;#test&#39;).datagrid(&#39;unselectRow&#39;,2);
        }
        function mergeCells(){
            $(&#39;#test&#39;).datagrid(&#39;mergeCells&#39;,{
                index:2,
                field:&#39;addr&#39;,
                rowspan:2,
                colspan:2
            });
        }
    </script>

The above is the detailed content of Example analysis: statistical information management, Spring annotation development and EasyUI. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How does IntelliJ IDEA identify the port number of a Spring Boot project without outputting a log?How does IntelliJ IDEA identify the port number of a Spring Boot project without outputting a log?Apr 19, 2025 pm 11:45 PM

Start Spring using IntelliJIDEAUltimate version...

How to elegantly obtain entity class variable names to build database query conditions?How to elegantly obtain entity class variable names to build database query conditions?Apr 19, 2025 pm 11:42 PM

When using MyBatis-Plus or other ORM frameworks for database operations, it is often necessary to construct query conditions based on the attribute name of the entity class. If you manually every time...

How to use the Redis cache solution to efficiently realize the requirements of product ranking list?How to use the Redis cache solution to efficiently realize the requirements of product ranking list?Apr 19, 2025 pm 11:36 PM

How does the Redis caching solution realize the requirements of product ranking list? During the development process, we often need to deal with the requirements of rankings, such as displaying a...

How to safely convert Java objects to arrays?How to safely convert Java objects to arrays?Apr 19, 2025 pm 11:33 PM

Conversion of Java Objects and Arrays: In-depth discussion of the risks and correct methods of cast type conversion Many Java beginners will encounter the conversion of an object into an array...

How do I convert names to numbers to implement sorting and maintain consistency in groups?How do I convert names to numbers to implement sorting and maintain consistency in groups?Apr 19, 2025 pm 11:30 PM

Solutions to convert names to numbers to implement sorting In many application scenarios, users may need to sort in groups, especially in one...

E-commerce platform SKU and SPU database design: How to take into account both user-defined attributes and attributeless products?E-commerce platform SKU and SPU database design: How to take into account both user-defined attributes and attributeless products?Apr 19, 2025 pm 11:27 PM

Detailed explanation of the design of SKU and SPU tables on e-commerce platforms This article will discuss the database design issues of SKU and SPU in e-commerce platforms, especially how to deal with user-defined sales...

How to set the default run configuration list of SpringBoot projects in Idea for team members to share?How to set the default run configuration list of SpringBoot projects in Idea for team members to share?Apr 19, 2025 pm 11:24 PM

How to set the SpringBoot project default run configuration list in Idea using IntelliJ...

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools