javawebMVC and addition, deletion, modification and query
MVC and CRUD 1. MVC 1.1. What is MVC MVC= model model+ view View+ controller controller is a software architecture model in software engineering that divides the software system into three basic parts: model;: entity entity class and dao:interface implementation class(data operation) view:: jsp page The displayed controller :servlet receives the request and responds The MVC pattern was first proposed by Trygve Reenskaug , for Xerox Palo Alto Research Center(Xerox A software design pattern invented by PARC’s Smalltalk language. 1.2. What is the use of MVC MVC can facilitate the later maintenance and expansion of the program, and facilitate the reuse of certain parts of the program. And MVC also makes the program simpler and more intuitive. Note that:mvc does not only exist in java,mvc is a design pattern(three-tier architecture)&# xff0c; Almost all software with B/s structure adopts the MVC design pattern Some functions of MVC cannot be implemented or are not needed when actually used MVC is the development model followed by all programs ,Some operations in Java cannot be implemented in MVC 1.3, what are the versions of MVC 1.3.1, version JavaWeb has gone through three periods: JSP ModelOne 1.1, JSP ModelOne second generation 1.2, and JSP Model2.…
JavaScript02 array type addition, deletion, modification and query
java ip Array instance string join push Queue filter Write your review! Come on, watch it all Member login | User registration Recommended reading (adsbygoogle = window.adsbygoogle || []).push({}); <!– –> .syntaxhighlighter{ width: 740px; padding-top:40px;padding-bottom:20px; border: 1px solid #333; background: url(“/style/SyntaxHighlighter/top_bg.svg”); background-size: 43px; background-repeat: no-repeat; margin-bottom: -7px; border-radius: 15px; background-position: 16px 12px; padding-left: 10px; } .gutter{ display: none; }
JavaWeb (10) JDBC addition, deletion, modification and query, C3P0 and other connection pools, use of dbutils framework
I made a very rubbish little demo before. I really can’t face it. It’s a very tricky thing. It’s really good, so work hard. Rookie. ——-WH 1. What is JDBC? Java Data Base Connectivity, java database connection, when you need to store some data or get some data, you need to access the data in the database, so how does java connect to the database? What steps are required? 1. Register driver What is a driver? The driver is the JDBC implementation class. In layman’s terms, the thing that can connect to the database function is the driver. Since there are many databases on the market, such as Oracle, MySql, etc., Java has an implementation specification interface for connecting to the database, defined A series of database connection interfaces (java.sql.Driver interface), but no implementation is provided, and each database manufacturer provides specific implementations of these interfaces. In this way, no matter what database is used, the code written by our developers They are all the same, so there is no need to write them differently because of different databases. The only difference is that the database drivers are different. If you use mysql, you must use the mysql driver. If…
java database, java database addition, deletion, modification and query
List of contents of this article: 1. What is the relationship between java and database? 2. How to use JAVA to connect to the database? 3. How to implement the connection with the backend database in Java connect? What is the relationship between java and database? 1. Java is a programming language. It is a connection tool for realizing how to connect customers and data. You can understand it this way. You want to search for all the books in the library. There is no programming language to turn a certain information into a system. You can only go to the library and read it one by one to find it. With a programming language, you can specifically create a query system. This system integrates the contents of all books into one place, and then searches for the desired information through the query system written in Java, which is electronic , which can provide more people to search at the same time, and also save more people the time of searching alone. This is what programming languages do. 2. What does the database do: As we mentioned above, it is to place the contents of all books in one place,…
Springboot+MybatisPlus efficiently implements addition, deletion, modification and query, Alibaba Java written test
3. Run the generator code Console prompt When entering the table name, enter the table name and press Enter to generate Generate The complete catalog is as follows : 3. Configure Mybatis-Plus Before using Mybatis-Plus, we also need to perform some configurations – including springboot startup class, database connection and Mybatis-Plus configuration. 1. springboot startup class: SpringBootApplication public class UserServiceApp {public static void main(String [] args) {SpringApplication.run(UserServiceApp.class, args);}} 2.application.yml file: server:port: 8092spring:datasource:driver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://192.168.67.129:3306/mybatis_plus?useUnicode= ;true&serverTimezone=Asia/Shanghai&characterEncoding=UTF-8&nullCatalogMeansCurrent=trueusername: rootpassword: rootmybatis-plus:mapper-locations: classpath*:mapper/**/*.xml#Entity Scanning,Multiple packages Separate type-aliases-package with commas or semicolons: com.huangtl.user.entityconfiguration:log-impl: org.apache.ibatis.logging.stdout.StdOutImpl Mainly configures the database Connection and mybatis-plus scanning – Dao layer Mapper scanning also requires a configuration class. 3.MybatisPlusConfig class: package com.huangtl.user.config;import org.mybatis.spring.annotation.MapperScan;import org .springframework.context.annotation.Configuration;@Configuration@MapperScan({“com.huangtl.user.mapper*”})public class MybatisPlusConfig {} &# 64;Configuration description is the configuration class of springboot. @MapperScan specifies scanning the Mapper interface at the specified location. Okay,So you can use the code to successfully use Mybatis-Plus to operate the database,Let’s take a look at the usage examples of Mybatis-Plus. 4. CURD Example The generated code structure has been explained above. We will mainly look at the service layer classes here, which contains almost all Added new query method. Let’s first look at the service implementation class. This is mainly a service…
Re-learning java – basics of addition, deletion, modification and query
package com.it.tt5;import java.security.PublicKey;import java.util.ArrayList;public class Student {// public static void main(String[] args) { ArrayList arrayList = new ArrayList(); //add element arrayList.add(“hello”); arrayList.add(“world”); arrayList.add(“java”); //delect direct element deletes the top element and returns whether the deletion is successful // public boolean remove(Object o);// System.out.println(arrayList.remove(“hello”)); // System.out.print(arrayList.remove(1));Delete Set the element at the top index and return the deleted element// console is world[hello, java] // Modify// System.out.print(arrayList.set(1, “mimimi”)); //world[hello, mimimi, java] returns the modified element and modifies, // Search// System.out.print(arrayList. get(1));// System.out.print(arrayList.get(2));// System.out.print(arrayList.get(3)); out of bounds will occur //input console System.out.print(arrayList); }} As shown in the picture Example of adding student information stdentexment;package com.it.tt5;import java.util.ArrayList;import java.util.Scanner;import java.util.jar.Attributes.Name;public class studentexment { public static void main(String[] args) { // TODO Auto-generated method stub ArrayList arrayList = new ArrayList(); Scanner scanner = new Scanner(System.in); System.out.print(“name:”); String naemString=scanner.nextLine() ; System.out.println(“age:”); String naemString2=scanner.nextLine(); Studtentest s = new Studtentest(); // Error: Name a = new Name(null);//Age b = new Age(null); //Create student object s.setName(naemString); s.setAge(naemString2); arrayList.add(s); //Add objects to the collection for(int i=0;i Studtentest s5 = arrayList.get(i); System.out.print(s.getName()+”,”+s.getAge()); } System.out.print(s); } } Studentest classpackage com.it.tt5;//Students are tiredpublic class Studtentest { private String name; private String age; public Studtentest(){ } public Studtentest (String name,String age) { this.name=name; this.age=age; } public…
thinkphp implements basic addition, deletion, modification and query
ThinkPHPProvides flexible and convenient data operation methods, which not only realizes the four basic operations of database operations (CURD): The implementation of creating, reading, updating and deleting also has many practical data operation methods built in. Next, we will learn these basic operation methods together, and at the end An example is prepared for everyone to deepen their understanding. Add new data // Instantiate a User model object $User = new UserModel(); // Then assign a value to the data object $User->name = 'ThinkPHP'; $User->email = '[email protected]'; // Then you can save the new User object $User->add(); //If you need to lock and pass in data when instantiating the model object, you can use $data['name'] = 'ThinkPHP'; $data['email'] = '[email protected]'; $User = new UserModel($data); $User->add(); // Or directly pass in the data to be created in the add method $data['name'] = 'ThinkPHP'; $data['email'] = '[email protected]'; $User = new UserModel(); $User->add($data); Generally, the data objects in the application are unlikely to be written through manual assignment, but there is a data object creation process. ThinkPHPProvides acreatemethod to create data objects, and then perform other adding or editing operations. $User = D(“User”); $User->create(); //Create User data object, which is created by default…
PHP addition, deletion, modification and query, demo written by myself
PHP addition, deletion, modification and query, demo written by myself 1. General method of linking database: conn.php 2. Add add.php Title: Content: 3. Delete del.php if(!empty($_GET['del'])){ $d=$_GET['del']; $sql=”delete from news where id =' $d'”; } $query=mysql_query($sql); echo “Delete successfully”; ?> 4, change the edit.php page
PHP+MYSQL realizes user addition, deletion, modification and query, mysql addition and deletion_PHP tutorial
PHP+MYSQL realizes user addition, deletion, modification and query, mysql addition and deletion File list. . document content. . dbconn.php userListt.php editUser.php editDo.php detailUser.php deleteUser.php addUser.php addDo.php id Username Password Gender Age Date of birth Hobbies Registration time Last login time Operation <?php require_once 'inc/dbConn.php'; //What is this? . date_default_timezone_set("PRC"); //Read data. . . $sql = "select * from user order by id asc"; $result = mysql_query($sql,$con); $userList = ''; while($rs = mysql_fetch_array($result)){ $userList[] = $rs; } // Loop through the user list foreach ($userList as $user){ echo " “.$user[‘id’].” “.$user[‘username’].” “.$user[‘password’].” “.$user[‘sex’].” “.$user[‘age’].” “.date(“Y-m-d”,$user[‘birthday’]).” “.$user[‘hobby’].” “.date(“Y-m-d”,$user[‘add_time’]).” “.date(“Y-m-d”,$user[‘last_login’]).” increase  Delete  Change  Check “; } ?> <input type="hidden" name="user_id" value="”/> Username <input type="text" name="user_name" size="10" value= /> Password <input type="password" name="password" size="10" value= /> Gender <input type="radio" name="sex" value="male" /> Male<input type="radio" name="sex" value ="Female" />Female Age <input type="text" name="age" size="3" value= /> Date of birth <option value="1980" >1980 <option value="1981" >1981 <option value="1982" >1982 <option value="1983" >1983 <option value="1984" >1984 <option value="1985" >1985 <option value="1986" >1986 <option value="1987" >1987 <option value="1988" >1988 <option value="1989" >1989 <option value="1990" >1990 Year <option value="1" >1<1987 1988 1989 1990 Year 1 2 3 4 5 6 7 8 9 10 11 12 moon 1 2…
PHP simple method to operate MongoDB (installation, addition, deletion, modification and query), mongodb addition and deletion_PHP tutorial
How to simply operate MongoDB with PHP (installation, addition, deletion, modification and query), add and delete mongodb This article describes the simple method of operating MongoDB with PHP. Share it with everyone for your reference, the details are as follows: If PHP operates MongoDB, first download the MongoDB expansion package from the Internet, https://github.com/mongodb/mongo-php-driver/downloads, and select the corresponding expansion package. I downloaded this and decompressed it. VC6 is suitable for apache, VC9 is suitable for IIS, and ts (thread safe) means that PHP runs in the form of a module. Then put the php_mongo.dll in the ext folder in PHP, then add extension=php_mongo.dll to PHP.INI and restart apache. Now the PHP extension MongoDB package is installed. For information on querying some MongoDB functions, please refer to the manual http://us.php.net/manual/en/class.mongocollection.php PHPDataBase; $collection = $db->PHPCollection; /*——————————– * delete *——————————– $collection->remove(array(“name” => “xixi111”)); */ /*——————————— * insert *——————————– for($i = 0;$i “xixi”.$i,”email” => “673048143_”.$i.”@qq.com”,”age” => $i*1+20); $collection->insert($data); } */ /*———————————- * Find *——————————– $res = $collection->find(array(“age” => array(‘$gt’ => 25,’$lt’ => 40)),array(“name” => true)); foreach($res as $v) { print_r($v); } */ /*———————————- * renew *——————————– $collection->update(array(“age” =>22),array(‘$set’ => array(“name” => “demoxixi”))); */ ?> Readers who are interested in more PHP-related content can check…