当前位置:网站首页>_ Mold_ Board_
_ Mold_ Board_
2022-04-23 16:50:00 【Kramer_ one hundred and forty-nine】
front end
AJAX request
$ajax({
url : "",
data : {
},
type : "",
dataType : "",
success : function(){
}
})
url Don't to "/" start , With webapp At the beginning of the directory under , such as workbench/xxx/xxx/xxx.jsp
web.xml 4.0
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
</web-app>
jsp Page character encoding 、 Take the path
Top write
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/";
%>
stay head The label says <base href="<%=basePath%>">
take html Change to jsp after , Delete... From all paths ../
added base After tag , All relative paths fail , Absolute path must be used .( from webapp Next time )
Back end
MySQL link URL
sentence jdbc:mysql://localhost:3306/ssm?serverTimezone=UTC
JDK Compiled version
pom In file
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
pom Resource file
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
MyBatis Reverse engineering files
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!-- Specifies the connection to the database JDBC The location of the driver package , Specify the full path to your computer : Modify according to the specific situation -->
<classPathEntry location="D:\PROGRAM\MySQL\mysql-connector-java-8.0.20\mysql-connector-java-8.0.20.jar"/>
<!-- To configure table Table information content body ,targetRuntime Specify the use of MyBatis3 Version of -->
<context id="tables" targetRuntime="MyBatis3">
<!-- Suppress generation of comments , Because the generated annotations are all in English , You can't let it generate -->
<commentGenerator>
<property name="suppressAllComments" value="true" />
</commentGenerator>
<!-- Configure the database connection information : Modify according to the specific situation -->
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/springboot?serverTimezone=UTC" userId="root" password="123456">
<property name="nullCatalogMeansCurrent" value="true"/>
</jdbcConnection>
<!-- Generate model class ,targetPackage Appoint model Class ,targetProject Specify the generated model Under which project : Modify according to the specific situation -->
<javaModelGenerator targetPackage="com.daihan.springboot.model" targetProject="src/main/java">
<property name="enableSubPackages" value="false"/>
<property name="trimStrings" value="false"/>
</javaModelGenerator>
<!-- Generate MyBatis Of Mapper.xml file ,targetPackage Appoint mapper.xml The package name of the file ,targetProject Specify the generated mapper.xml Under which project -->
<sqlMapGenerator targetPackage="com.daihan.springboot.mapper" targetProject="src/main/java">
<property name="enableSubPackages" value="false"/>
</sqlMapGenerator>
<!-- Generate MyBatis Of Mapper Interface class file ,targetPackage Appoint Mapper The package name of the interface class ,targetProject Specify the generated Mapper Which project is the interface placed under -->
<javaClientGenerator type="XMLMAPPER" targetPackage="com.daihan.springboot.mapper" targetProject="src/main/java">
<property name="enableSubPackages" value="false"/>
</javaClientGenerator>
<!-- Database table name and corresponding Java Model class name -->
<table tableName="t_Student" domainObjectName="Student" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" />
</context>
</generatorConfiguration>
hold jar Package import maven in
stay jar Execute in the directory where the package is located cmd
Enter the command
mvn install:install-file -Dfile=jar Package name .jar -DgroupId=maven Corresponding groupid -DartifactId=maven Corresponding artifactId -Dversion=4.2 Version number -Dpackaging=jar
Mysql URL
mysql://localhost:3306/database?useUnicode=true&characterEncoding=utf8&autoReconnect=true&rewriteBatchedStatements=TRUE
The back end accepts and processes JSON
Accept parameters
@RequestBody
Accept the request body
@RequestHeader
Accept request header
// The request bodies accepted here are Data generic list, Accept... In the request header id by myId
public ResponseEntity courseDataSync(@RequestBody List<Data> data,@RequestHeader("id") String myId) {
// Specifically Java sentence
}
Data Class definition
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UpstreamSyncCourseData {
private String id;
private String name;
private String description;
private String announcement = "";
//json Medium course_start_time Corresponding Data Class courseStartTime Variable
@JsonProperty(value = "course_start_time")
private Long courseStartTime;
@JsonProperty(value = "advance_days")
private Integer courseCreateTime;
}
Output JSON
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
public class MyTest {
public static void main(String[] args) throws JsonProcessingException {
Phone phone = new Phone();
phone.setName(" millet ");
phone.setColor(" Red ");
phone.setPrice(2000);
ObjectMapper mapper = new ObjectMapper();
String value = mapper.writeValueAsString(phone);
System.out.println(value);
//{"name":" millet ","color":" Red ","price":2000}
}
}
版权声明
本文为[Kramer_ one hundred and forty-nine]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231359460394.html
边栏推荐
- DanceNN:字节自研千亿级规模文件元数据存储系统概述
- Detailed explanation of information abstract, digital signature, digital certificate, symmetric encryption and asymmetric encryption
- 5-minute NLP: text to text transfer transformer (T5) unified text to text task model
- Selenium IDE and XPath installation of chrome plug-in
- Quick install mongodb
- JMeter installation tutorial and solutions to the problems I encountered
- On the security of key passing and digital signature
- 面试百分百问到的进程,你究竟了解多少
- The font of the soft cell changes color
- TypeError: set_figure_params() got an unexpected keyword argument ‘figsize‘
猜你喜欢
Nifi fast installation and file synchronization
Loggie source code analysis source file module backbone analysis
File upload and download of robot framework
NVIDIA显卡驱动报错
Do you really understand the principle of code scanning login?
How to choose the wireless gooseneck anchor microphone and handheld microphone scheme
vim编辑器的实时操作
The font of the soft cell changes color
VLAN高级技术,VLAN聚合,超级Super VLAN ,Sub VLAN
100 deep learning cases | day 41 - convolutional neural network (CNN): urbansound 8K audio classification (speech recognition)
随机推荐
Derivation of Σ GL perspective projection matrix
Encapsulating the logging module
Qipengyuan horizon credible meta universe social system meets diversified consumption and social needs
MySQL restores data through binlog file
Real time operation of vim editor
vscode如何比较两个文件的异同
Ali developed three sides, and the interviewer's set of combined punches made me confused on the spot
TypeError: set_ figure_ params() got an unexpected keyword argument ‘figsize‘
安装及管理程序
博士申请 | 厦门大学信息学院郭诗辉老师团队招收全奖博士/博后/实习生
PHP高效读大文件处理数据
Dancenn: overview of byte self-developed 100 billion scale file metadata storage system
关于局域网如何组建介绍
English | day15, 16 x sentence true research daily sentence (clause disconnection, modification)
Take according to the actual situation, classify and summarize once every three levels, and see the figure to know the demand
org. apache. parquet. schema. InvalidSchemaException: A group type can not be empty. Parquet does not su
Introduction to how to set up LAN
How does flash cache data in memory?
[pimf] openharmony paper Club - what is the experience of wandering in ACM survey
5-minute NLP: text to text transfer transformer (T5) unified text to text task model