search
HomeDatabaseMysql Tutorial动态表单(一)动态表单的定义

什么是动态表单? 根据爱因斯坦相对论有动态表单说明是有静态表单的存在,生活中乃至世界任何两个有质量的物体都是运动的,这只是相对论的狭隘解析即狭义相对论,平常我们讨论的也往往是狭义相对论,这一理论的提出给物理学带来了革命性的变化,共同奠定了现

什么是动态表单?

根据爱因斯坦相对论有动态表单说明是有静态表单的存在,生活中乃至世界任何两个有质量的物体都是运动的,这只是相对论的狭隘解析即狭义相对论,平常我们讨论的也往往是狭义相对论,这一理论的提出给物理学带来了革命性的变化,共同奠定了现代物理学的基础。相对论极大地改变了人类对宇宙和自然的“常识性”观念,丰富了我们的常识。

看到动态表单也许你会想到动态、静态网页,它们和动态表单有什么区别呢?我觉的它们本质没有区别只是生成的时间不同而已,静态网页在编码阶段即可固定,以后它的内容也不会再有所改变;动态网页虽然编码阶段结构也确定了但是它的内容可以改变,可以让用户自己选择、可以和用户交互。

动态表单的目的是为了根据业务流程不同灵活设计显示页面,显然,在业务流程设计阶段不用过多的考虑表单如何实现,将业务流程与表单显示分离开了,充分体现了MVC思想,我们可以把动态表单看成了V层的具体实现。

动态表单建模

记得前几天看了一本小书叫《成交》,深刻剖析了一个大型IT公司的发展历程以及各个人物的思想活动里面有一句“攻城为下,攻心为上”,这句话说的的确很对,在生成表单时只有知道表单核心组成元素才能组装出表单,生成动态表单时也展现出了另一个编程思想OOP面向对象编程,生成表单也就是组装过程,按照这个思想我们把表单拆分、建模,持久化到数据库中。

下图是抽象出来的表单类图

\

一个表单是由多个表单域组成,每个表单域有名称、输入框类型、输入数据类型,如果是列表框还会有条目的添加,这就是最简单的动态表单,如果表单上还有一些复杂控件会麻烦一些但是流程是一样的。

持久化到数据库中

将表单数据保存到数据库中,等需要的时候直接从数据库里面加载即可,看一下生成的一些表。

\

表单的显示

下一篇博客中将介绍表单显示,通过freemarker插件来动态显示页面!

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 to install MySQL on Linux systemHow to install MySQL on Linux systemApr 29, 2025 pm 03:57 PM

Installing MySQL on Linux can be done through the package manager. The specific steps are as follows: 1. On Ubuntu, use apt to update the package list and install the MySQL server; 2. On CentOS, use yum to install the MySQL community version and start the service. After installation, basic configuration needs to be performed, such as setting the root password and creating database and users.

Creation and usage scenarios of MySQL viewsCreation and usage scenarios of MySQL viewsApr 29, 2025 pm 03:54 PM

MySQL views are virtual tables generated based on SQL queries. 1. Create a view: Use the CREATEVIEW statement combined with SELECT query. 2. Usage scenarios: simplify complex queries, data abstraction and ensure data consistency. 3. Optimization strategy: simplify underlying queries, use indexes, and consider materialized views.

Specify character sets and collations when creating databases in MySQLSpecify character sets and collations when creating databases in MySQLApr 29, 2025 pm 03:51 PM

When creating a database in MySQL, character sets and collation rules should be specified to ensure data accuracy and improve query performance. 1) Use the CREATEDATABASEmy_databaseCHARACTERSETutf8mb4COLLATIONutf8mb4_unicode_ci command to create a database, select the utf8mb4 character set and utf8mb4_unicode_ci collation. 2) utf8mb4 supports more Unicode characters, while utf8mb4_unicode_ci provides case-insensitive comparisons. 3) Ensure that the application layer and database layer use the same character set and collation rules to avoid potential problems.

How to sort and rank data in MySQLHow to sort and rank data in MySQLApr 29, 2025 pm 03:48 PM

In MySQL, sorting uses the ORDERBY clause, and ranking uses the RANK(), DENSE_RANK(), and ROW_NUMBER() functions. 1. Sort: Use ORDERBY clause, such as SELECT*FROMemployeesORDERBYsalaryDESC; 2. Ranking: Use window functions, such as SELECTemployee_name, salary, RANK()OVER(ORDERBYsalaryDESC)ASrankFROMemployees; these operations are based on SQL query optimizer and execution engine, and are often used to sort quickly or merge sort, and ranking depends on window function calculation.

Creation and calling methods of MySQL stored proceduresCreation and calling methods of MySQL stored proceduresApr 29, 2025 pm 03:45 PM

To create and call stored procedures in MySQL, follow the following steps: 1. Create stored procedures: Use the CREATEPROCEDURE statement to define stored procedures, including names, parameters, and SQL statements. 2. Compile stored procedures: MySQL compiles stored procedures into executable code and stores them. 3. Call stored procedure: use CALL statement and pass parameters. 4. Execute stored procedures: MySQL executes the SQL statements in it, processes parameters and returns the result.

How to set up MySQL service automatically startsHow to set up MySQL service automatically startsApr 29, 2025 pm 03:42 PM

The MySQL service can be set to automatically start on Windows, Linux, and macOS. 1) On Windows, use the command "scconfigmysqlstart=auto" to configure. 2) On Linux, enable it using "sudosystemctlenablemysql". 3) On macOS, create and load the launchd configuration file to achieve automatic startup.

How to view detailed structure information of MySQL tablesHow to view detailed structure information of MySQL tablesApr 29, 2025 pm 03:39 PM

The methods to view the MySQL table structure include: 1. Use the DESCRIBE command to view column information; 2. Use the SHOWCREATETABLE command to view table creation statements; 3. Use information_schema to query more detailed information. These methods help to quickly understand table structure and improve work efficiency.

Detailed explanation of the installation steps of MySQL on macOS systemDetailed explanation of the installation steps of MySQL on macOS systemApr 29, 2025 pm 03:36 PM

Installing MySQL on macOS can be achieved through the following steps: 1. Install Homebrew, using the command /bin/bash-c"$(curl-fsSLhttps://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)". 2. Update Homebrew and use brewupdate. 3. Install MySQL and use brewinstallmysql. 4. Start MySQL service and use brewservicesstartmysql. After installation, you can use mysql-u

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

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

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.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment