• SpringMVC之CRUD和文件上传下载


    目录

    一、CRUD(增删改查)

    1、导入pom依赖

    2、框架配置文件

    3、web.xml

    4、工具类(分页)

    4、增删改查

     二、图片上传

    1、步骤

    2、导pom依赖

    3、springmvc-servlet.xml配置

    4、Dto编写

    三、下载

    1、步骤


    一、CRUD(增删改查)

    1、导入pom依赖

    1. "1.0" encoding="UTF-8"?>
    2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    4. <parent>
    5. <artifactId>mybatis001artifactId>
    6. <groupId>org.examplegroupId>
    7. <version>1.0-SNAPSHOTversion>
    8. parent>
    9. <modelVersion>4.0.0modelVersion>
    10. <artifactId>ssm2artifactId>
    11. <packaging>warpackaging>
    12. <name>ssm2 Maven Webappname>
    13. <url>http://www.example.comurl>
    14. <properties>
    15. <project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
    16. <maven.compiler.source>1.8maven.compiler.source>
    17. <maven.compiler.target>1.8maven.compiler.target>
    18. <maven.compiler.plugin.version>3.7.0maven.compiler.plugin.version>
    19. <spring.version>5.0.2.RELEASEspring.version>
    20. <mybatis.version>3.4.5mybatis.version>
    21. <mysql.version>5.1.44mysql.version>
    22. <pagehelper.version>5.1.2pagehelper.version>
    23. <mybatis.spring.version>1.3.1mybatis.spring.version>
    24. <commons.dbcp2.version>2.1.1commons.dbcp2.version>
    25. <commons.pool2.version>2.4.3commons.pool2.version>
    26. <log4j2.version>2.9.1log4j2.version>
    27. <junit.version>4.12junit.version>
    28. <servlet.version>4.0.0servlet.version>
    29. <lombok.version>1.18.2lombok.version>
    30. properties>
    31. <dependencies>
    32. <dependency>
    33. <groupId>org.springframeworkgroupId>
    34. <artifactId>spring-contextartifactId>
    35. <version>${spring.version}version>
    36. dependency>
    37. <dependency>
    38. <groupId>org.springframeworkgroupId>
    39. <artifactId>spring-ormartifactId>
    40. <version>${spring.version}version>
    41. dependency>
    42. <dependency>
    43. <groupId>org.springframeworkgroupId>
    44. <artifactId>spring-txartifactId>
    45. <version>${spring.version}version>
    46. dependency>
    47. <dependency>
    48. <groupId>org.springframeworkgroupId>
    49. <artifactId>spring-aspectsartifactId>
    50. <version>${spring.version}version>
    51. dependency>
    52. <dependency>
    53. <groupId>org.springframeworkgroupId>
    54. <artifactId>spring-webartifactId>
    55. <version>${spring.version}version>
    56. dependency>
    57. <dependency>
    58. <groupId>org.springframeworkgroupId>
    59. <artifactId>spring-testartifactId>
    60. <version>${spring.version}version>
    61. dependency>
    62. <dependency>
    63. <groupId>org.mybatisgroupId>
    64. <artifactId>mybatisartifactId>
    65. <version>${mybatis.version}version>
    66. dependency>
    67. <dependency>
    68. <groupId>mysqlgroupId>
    69. <artifactId>mysql-connector-javaartifactId>
    70. <version>${mysql.version}version>
    71. dependency>
    72. <dependency>
    73. <groupId>com.github.pagehelpergroupId>
    74. <artifactId>pagehelperartifactId>
    75. <version>${pagehelper.version}version>
    76. dependency>
    77. <dependency>
    78. <groupId>org.mybatisgroupId>
    79. <artifactId>mybatis-springartifactId>
    80. <version>${mybatis.spring.version}version>
    81. dependency>
    82. <dependency>
    83. <groupId>org.apache.commonsgroupId>
    84. <artifactId>commons-dbcp2artifactId>
    85. <version>${commons.dbcp2.version}version>
    86. dependency>
    87. <dependency>
    88. <groupId>org.apache.commonsgroupId>
    89. <artifactId>commons-pool2artifactId>
    90. <version>${commons.pool2.version}version>
    91. dependency>
    92. <dependency>
    93. <groupId>org.apache.logging.log4jgroupId>
    94. <artifactId>log4j-coreartifactId>
    95. <version>${log4j2.version}version>
    96. dependency>
    97. <dependency>
    98. <groupId>org.apache.logging.log4jgroupId>
    99. <artifactId>log4j-apiartifactId>
    100. <version>${log4j2.version}version>
    101. dependency>
    102. <dependency>
    103. <groupId>org.apache.logging.log4jgroupId>
    104. <artifactId>log4j-webartifactId>
    105. <version>${log4j2.version}version>
    106. dependency>
    107. <dependency>
    108. <groupId>junitgroupId>
    109. <artifactId>junitartifactId>
    110. <version>${junit.version}version>
    111. <scope>testscope>
    112. dependency>
    113. <dependency>
    114. <groupId>javax.servletgroupId>
    115. <artifactId>javax.servlet-apiartifactId>
    116. <version>${servlet.version}version>
    117. <scope>providedscope>
    118. dependency>
    119. <dependency>
    120. <groupId>org.projectlombokgroupId>
    121. <artifactId>lombokartifactId>
    122. <version>${lombok.version}version>
    123. <scope>providedscope>
    124. dependency>
    125. <dependency>
    126. <groupId>org.springframeworkgroupId>
    127. <artifactId>spring-webmvcartifactId>
    128. <version>${spring.version}version>
    129. dependency>
    130. <dependency>
    131. <groupId>javax.servlet.jspgroupId>
    132. <artifactId>javax.servlet.jsp-apiartifactId>
    133. <version>2.3.3version>
    134. dependency>
    135. <dependency>
    136. <groupId>jstlgroupId>
    137. <artifactId>jstlartifactId>
    138. <version>1.2version>
    139. dependency>
    140. <dependency>
    141. <groupId>taglibsgroupId>
    142. <artifactId>standardartifactId>
    143. <version>1.1.2version>
    144. dependency>
    145. <dependency>
    146. <groupId>commons-fileuploadgroupId>
    147. <artifactId>commons-fileuploadartifactId>
    148. <version>1.3.3version>
    149. dependency>
    150. dependencies>
    151. <build>
    152. <finalName>ssm2finalName>
    153. <resources>
    154. <resource>
    155. <directory>src/main/javadirectory>
    156. <includes>
    157. <include>**/*.xmlinclude>
    158. includes>
    159. resource>
    160. <resource>
    161. <directory>src/main/resourcesdirectory>
    162. <includes>
    163. <include>jdbc.propertiesinclude>
    164. <include>*.xmlinclude>
    165. includes>
    166. resource>
    167. resources>
    168. <pluginManagement>
    169. <plugins>
    170. <plugin>
    171. <groupId>org.apache.maven.pluginsgroupId>
    172. <artifactId>maven-compiler-pluginartifactId>
    173. <version>${maven.compiler.plugin.version}version>
    174. <configuration>
    175. <source>${maven.compiler.source}source>
    176. <target>${maven.compiler.target}target>
  • 相关阅读:
    【ZYNQ】petalinux实现开机自启动
    频频刷屏朋友圈,白酒如何越来越年轻化?来聊聊白酒企业数字化
    DeepMCP网络详解
    Cache学习(1):常见的程序运行模型&多级Cache存储结构
    【八】http服务器开发--实现一个http服务器
    git查看日志
    华为认证云计算专家(HCIE-Cloud Computing)–单选题
    JavaWeb三大组件【Servlet】【Filter】【Listener】学习笔记
    UE4/UE5像素流送云推流|程序不稳定、弱网画面糊怎么办?
    数据库连接池的使用
  • 原文地址:https://blog.csdn.net/m0_62528678/article/details/126411240