guyanqing пре 1 година
родитељ
комит
3c8322655d
30 измењених фајлова са 639 додато и 33 уклоњено
  1. 2 14
      04maven/spring/.idea/workspace.xml
  2. 124 0
      springmvc/.idea/uiDesigner.xml
  3. 22 15
      springmvc/.idea/workspace.xml
  4. 18 0
      springmvc/pom.xml
  5. 27 0
      springmvc/src/main/java/com/sf/conroller/Author.java
  6. 61 0
      springmvc/src/main/java/com/sf/conroller/Book.java
  7. 108 0
      springmvc/src/main/java/com/sf/conroller/BookController.java
  8. 77 2
      springmvc/src/main/java/com/sf/conroller/HelloController.java
  9. 3 1
      springmvc/src/main/webapp/WEB-INF/views/result.jsp
  10. 35 0
      springmvc/src/main/webapp/WEB-INF/web.xml
  11. 62 0
      springmvc/src/main/webapp/index.jsp
  12. BIN
      springmvc/target/classes/com/sf/conroller/Author.class
  13. BIN
      springmvc/target/classes/com/sf/conroller/Book.class
  14. BIN
      springmvc/target/classes/com/sf/conroller/BookController.class
  15. BIN
      springmvc/target/classes/com/sf/conroller/HelloController.class
  16. BIN
      springmvc/target/springmvc.war
  17. BIN
      springmvc/target/springmvc/WEB-INF/classes/com/sf/conroller/Author.class
  18. BIN
      springmvc/target/springmvc/WEB-INF/classes/com/sf/conroller/Book.class
  19. BIN
      springmvc/target/springmvc/WEB-INF/classes/com/sf/conroller/BookController.class
  20. BIN
      springmvc/target/springmvc/WEB-INF/classes/com/sf/conroller/HelloController.class
  21. BIN
      springmvc/target/springmvc/WEB-INF/lib/activation-1.1.jar
  22. BIN
      springmvc/target/springmvc/WEB-INF/lib/commons-fileupload-1.3.3.jar
  23. BIN
      springmvc/target/springmvc/WEB-INF/lib/commons-io-2.2.jar
  24. BIN
      springmvc/target/springmvc/WEB-INF/lib/jackson-annotations-2.11.3.jar
  25. BIN
      springmvc/target/springmvc/WEB-INF/lib/javaee-api-8.0.jar
  26. BIN
      springmvc/target/springmvc/WEB-INF/lib/javax.mail-1.6.0.jar
  27. BIN
      springmvc/target/springmvc/WEB-INF/lib/joda-time-2.3.jar
  28. 3 1
      springmvc/target/springmvc/WEB-INF/views/result.jsp
  29. 35 0
      springmvc/target/springmvc/WEB-INF/web.xml
  30. 62 0
      springmvc/target/springmvc/index.jsp

+ 2 - 14
04maven/spring/.idea/workspace.xml

@@ -5,20 +5,8 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="8c3e0ed0-6141-4ee9-a284-3fa2d43ee5eb" name="Changes" comment="">
-      <change afterPath="$PROJECT_DIR$/../../springmvc/.idea/compiler.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/../../springmvc/.idea/encodings.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/../../springmvc/.idea/jarRepositories.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/../../springmvc/.idea/misc.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/../../springmvc/.idea/vcs.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/../../springmvc/.idea/workspace.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/../../springmvc/pom.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/../../springmvc/src/main/java/com/sf/conroller/HelloController.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/../../springmvc/src/main/resources/spring-mvc.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/../../springmvc/src/main/webapp/WEB-INF/dispatcherServlet-servlet.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/../../springmvc/src/main/webapp/WEB-INF/views/result.jsp" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/../../springmvc/src/main/webapp/WEB-INF/web.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/../../springmvc/src/main/webapp/index.jsp" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/../../springmvc/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../../springmvc/.idea/workspace.xml" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -164,7 +152,7 @@
       <option name="number" value="Default" />
       <option name="presentableId" value="Default" />
       <updated>1689993904831</updated>
-      <workItem from="1689993906819" duration="76486000" />
+      <workItem from="1689993906819" duration="76525000" />
     </task>
     <servers />
   </component>

+ 124 - 0
springmvc/.idea/uiDesigner.xml

@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Palette2">
+    <group name="Swing">
+      <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
+      </item>
+      <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
+      </item>
+      <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
+        <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
+        <initial-values>
+          <property name="text" value="Button" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="RadioButton" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="CheckBox" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="Label" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+          <preferred-size width="200" height="200" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+          <preferred-size width="200" height="200" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+      </item>
+      <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+          <preferred-size width="-1" height="20" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+      </item>
+      <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+      </item>
+    </group>
+  </component>
+</project>

+ 22 - 15
springmvc/.idea/workspace.xml

@@ -10,20 +10,22 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="32ba8696-e546-42f9-8a17-6935ed145529" name="Changes" comment="">
-      <change afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/.idea/jarRepositories.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/src/main/java/com/sf/conroller/HelloController.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/src/main/resources/spring-mvc.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/dispatcherServlet-servlet.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/views/result.jsp" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/web.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/src/main/webapp/index.jsp" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/src/main/java/com/sf/conroller/Author.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/src/main/java/com/sf/conroller/Book.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/src/main/java/com/sf/conroller/BookController.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/../04maven/spring/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../04maven/spring/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/sf/conroller/HelloController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/sf/conroller/HelloController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/webapp/WEB-INF/views/result.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/views/result.jsp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/webapp/WEB-INF/web.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/webapp/WEB-INF/web.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main/webapp/index.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/webapp/index.jsp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/target/classes/com/sf/conroller/HelloController.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/sf/conroller/HelloController.class" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/target/springmvc.war" beforeDir="false" afterPath="$PROJECT_DIR$/target/springmvc.war" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/target/springmvc/WEB-INF/classes/com/sf/conroller/HelloController.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/springmvc/WEB-INF/classes/com/sf/conroller/HelloController.class" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/target/springmvc/WEB-INF/views/result.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/target/springmvc/WEB-INF/views/result.jsp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/target/springmvc/WEB-INF/web.xml" beforeDir="false" afterPath="$PROJECT_DIR$/target/springmvc/WEB-INF/web.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/target/springmvc/index.jsp" beforeDir="false" afterPath="$PROJECT_DIR$/target/springmvc/index.jsp" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -33,9 +35,9 @@
   <component name="FileTemplateManagerImpl">
     <option name="RECENT_TEMPLATES">
       <list>
+        <option value="spring-beans.schema" />
         <option value="Jsp File" />
         <option value="Class" />
-        <option value="spring-beans.schema" />
       </list>
     </option>
   </component>
@@ -72,6 +74,7 @@
     "project.structure.last.edited": "Modules",
     "project.structure.proportion": "0.15",
     "project.structure.side.proportion": "0.13333334",
+    "spring.configuration.checksum": "0861095ca1565183975151c5b2a14071",
     "vue.rearranger.settings.migration": "true"
   }
 }]]></component>
@@ -79,6 +82,9 @@
     <key name="MoveFile.RECENT_KEYS">
       <recent name="D:\Program Files\IntelliJ IDEA 2019.3.3\VIP23\springmvc\src\main\webapp\WEB-INF\views" />
     </key>
+    <key name="CopyClassDialog.RECENTS_KEY">
+      <recent name="com.sf.conroller" />
+    </key>
   </component>
   <component name="RunManager">
     <configuration name="Tomcat-springmvc" type="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory" factoryName="Local" APPLICATION_SERVER_NAME="Tomcat 9.0.70" ALTERNATIVE_JRE_ENABLED="false">
@@ -162,7 +168,8 @@
       <option name="number" value="Default" />
       <option name="presentableId" value="Default" />
       <updated>1690439501381</updated>
-      <workItem from="1690439502870" duration="6929000" />
+      <workItem from="1690439502870" duration="24084000" />
+      <workItem from="1690525438535" duration="4759000" />
     </task>
     <servers />
   </component>

+ 18 - 0
springmvc/pom.xml

@@ -37,10 +37,28 @@
       <artifactId>spring-webmvc</artifactId>
       <version>4.3.27.RELEASE</version>
     </dependency>
+
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-annotations</artifactId>
+      <version>2.11.3</version>
+    </dependency>
+
+    <!--  serlet-->
+    <!-- https://mvnrepository.com/artifact/javax/javaee-api -->
+    <dependency>
+      <groupId>javax</groupId>
+      <artifactId>javaee-api</artifactId>
+      <version>7.0</version>
+      <scope>provided</scope>
+    </dependency>
+
   </dependencies>
 
 
 
+
+
   <!--  spring-bom-->
   <dependencyManagement>
     <dependencies>

+ 27 - 0
springmvc/src/main/java/com/sf/conroller/Author.java

@@ -0,0 +1,27 @@
+package com.sf.conroller;
+
+public class Author {
+    private String name;
+
+    public Author() {
+    }
+
+    public Author(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public String toString() {
+        return "Author{" +
+                "name='" + name + '\'' +
+                '}';
+    }
+}

+ 61 - 0
springmvc/src/main/java/com/sf/conroller/Book.java

@@ -0,0 +1,61 @@
+package com.sf.conroller;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * 测试嵌套类型数据绑定
+ */
+public class Book {
+
+    private String bookName;
+
+    private String createTime;
+
+    private Author author;
+
+    public Book() {
+    }
+
+    public Book(String bookName, String createTime, Author author) {
+        this.bookName = bookName;
+        this.createTime = createTime;
+        this.author = author;
+    }
+
+    public String getBookName() {
+        return bookName;
+    }
+
+    public void setBookName(String bookName) {
+        this.bookName = bookName;
+    }
+
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public Author getAuthor() {
+        return author;
+    }
+
+    public void setAuthor(Author author) {
+        this.author = author;
+    }
+
+    @Override
+    public String toString() {
+        return "Book{" +
+                "bookName='" + bookName + '\'' +
+                ", createTime='" + createTime + '\'' +
+                ", author=" + author +
+                '}';
+    }
+}

+ 108 - 0
springmvc/src/main/java/com/sf/conroller/BookController.java

@@ -0,0 +1,108 @@
+package com.sf.conroller;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Map;
+
+@Controller
+@RequestMapping(value = "/book")
+public class BookController {
+
+    /**
+     * 合作原则:/book  ---BookController    --/addBook
+     * /book/addBook
+     * @return
+     */
+
+    @RequestMapping(value = "/getBook",method = RequestMethod.GET)
+    public String book(){
+        System.out.println("book-get");
+        return "result";
+    }
+
+
+    @RequestMapping(value = "/addBook",method = RequestMethod.POST)
+    public String book2(){
+        System.out.println("book-post");
+        return "result";
+    }
+
+
+    @RequestMapping(value = "/updateBook",method = RequestMethod.PUT)
+    public String book3(){
+        System.out.println("book-put");
+        return "result";
+    }
+
+
+    @RequestMapping(value = "/deleteBook",method = RequestMethod.DELETE)
+    public String book4(){
+        System.out.println("book-delete");
+        return "result";
+    }
+
+    /**
+     * 测试原生的数据模型
+     * @return
+     */
+
+    @RequestMapping(value = "/testJavaWebModel")
+    public String testJavaWebModel(HttpServletRequest request){
+        //将数据使用原生方式放在request域中
+    request.setAttribute("userName","韩梅梅");
+    return "result";
+    }
+
+
+    /**
+     * 测试springmvc的模型数据传递
+     * @return
+     */
+    @RequestMapping(value = "/testModelAndView")
+    public ModelAndView testModelAndView(){
+        ModelAndView modelAndView = new ModelAndView();
+        modelAndView.setViewName("result");
+        modelAndView.setStatus(HttpStatus.OK);
+//        将数据保存在域对象中
+        modelAndView.addObject("userName","李磊");
+        return modelAndView;
+    }
+
+    /**
+     * 测试model数据模型传递
+     * @param model
+     * @return
+     */
+
+    @RequestMapping("/testModel")
+    public String testModel(Model model){
+        model.addAttribute("userName","韩梅梅");
+        return "result";
+    }
+
+    @RequestMapping(value = "/testModelMap")
+    public String testModelMap(ModelMap modelMap){
+        /*向域对象中存数据*/
+        modelMap.addAttribute("userName","李雷");
+        return "result";
+    }
+
+    /**
+     * 测试map
+     * @param map
+     * @return
+     */
+    @RequestMapping(value = "/testMap")
+    public String testMap(Map map){
+        /*向域对象中存数据*/
+        map.put("userName","李雷Map");
+        return "result";
+    }
+}

+ 77 - 2
springmvc/src/main/java/com/sf/conroller/HelloController.java

@@ -1,7 +1,12 @@
 package com.sf.conroller;
 
+import org.springframework.beans.propertyeditors.CustomDateEditor;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.WebDataBinder;
+import org.springframework.web.bind.annotation.*;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
 
 @Controller
 public class HelloController {
@@ -10,10 +15,80 @@ public class HelloController {
     /**
      * string : "result":视图的名称
      * @return
+     * 200:成功
+     * 400/404:找不到  前端发送一个请求后端服务器没有对应的映射地址
+     * 500:后端服务器错误
+     * 405:方法不允许   --  Request method 'GET' not supported
+     *
      */
-    @RequestMapping(value = "/hello")
+    @RequestMapping(value = "/hello",method = RequestMethod.GET)
     public String hello(){
         System.out.println("hello");
         return "result";
     }
+
+
+    /**
+     * 测试  @PathVariable注解的数据绑定
+     *
+     * @param id
+     * @return
+     */
+    @RequestMapping(value = "/testPathVariable/{id}",method = RequestMethod.GET)
+    public String testPathVariable(@PathVariable("id") Integer id){
+        System.out.println("testPathVariable.....");
+        System.out.println(id);
+        return "result";
+    }
+
+    /**
+     * 测试拼接方式get请求的数据绑定
+     * @return
+     */
+    @RequestMapping(value = "/testGet",method = RequestMethod.GET)
+    public String testGet(Integer id ,Integer name){
+        System.out.println(id);
+        System.out.println(name);
+        return "result";
+    }
+
+
+    /**
+     * id=1001&id=1002
+     * @return
+     */
+    @RequestMapping(value = "testArray",method = RequestMethod.GET)
+    public String testArray(int[] id){
+        System.out.println("testArray...");
+        for (int i : id) {
+            System.out.println(i);
+        }
+        return "result";
+    }
+
+    /**
+     * 测试  @PathVariable注解的多数据绑定
+     * @return
+     */
+    @RequestMapping(value = "/testPathVariable2/{id}/{name}",method = RequestMethod.GET)
+    public String testPathVariable2(@PathVariable("id") Integer id,@PathVariable("name") String name){
+        System.out.println(id);
+        System.out.println(name);
+        return "result";
+    }
+
+
+    /**
+     * 测试嵌套数据绑定
+     * @param book
+     * @return
+     */
+
+    @RequestMapping(value = "/testBook",method = RequestMethod.POST)
+    public String testBook(Book  book){
+        System.out.println(book);
+        return "result";
+    }
+
+
 }

+ 3 - 1
springmvc/src/main/webapp/WEB-INF/views/result.jsp

@@ -5,12 +5,14 @@
   Time: 14:40
   To change this template use File | Settings | File Templates.
 --%>
-<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" isErrorPage="true" %>
 <html>
 <head>
     <title>结果页</title>
 </head>
 <body>
 <h1>ok...</h1>
+<br>
+${userName}
 </body>
 </html>

+ 35 - 0
springmvc/src/main/webapp/WEB-INF/web.xml

@@ -27,6 +27,41 @@
 -->
         <url-pattern>/</url-pattern>
     </servlet-mapping>
+    
+    
+<!--    解决中文乱码问题-->
 
+    <filter>
+        <filter-name>characterEncodingFilter</filter-name>
+        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
+<!--        设置参数-utf-8-->
+        <init-param>
+            <param-name>encoding</param-name>
+            <param-value>UTF-8</param-value>
+        </init-param>
+        <init-param>
+            <param-name>forceEncoding</param-name>
+            <param-value>true</param-value>
+        </init-param>
+        
+    </filter>
+    
+    <filter-mapping>
+        <filter-name>characterEncodingFilter</filter-name>
+<!--        拦截所有-->
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+    
+    
+<!--    配置restful风格的拦截器-->
+    <filter>
+        <filter-name>HiddenHttpMethodFilter</filter-name>
+        <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
+    </filter>
+    <filter-mapping>
+        <filter-name>HiddenHttpMethodFilter</filter-name>
+<!--        拦截所有-->
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
 
 </web-app>

+ 62 - 0
springmvc/src/main/webapp/index.jsp

@@ -16,5 +16,67 @@
 
 <a href="${pageContext.request.contextPath}/hello">HelloController</a>
 
+<br>
+<%--测试PathVariable 数据绑定--%>
+<a href="${pageContext.request.contextPath}/testPathVariable/1001">testPathVariable</a>
+
+<br>
+<a href="${pageContext.request.contextPath}/testGet?id=1002&name=admin">testGet</a>
+
+<br>
+<a href="${pageContext.request.contextPath}/testArray?id=1001&id=1002">testArray</a>
+
+<br>
+<a href="${pageContext.request.contextPath}/testPathVariable2/1003/admin">testPathVariable2</a>
+
+<br>
+
+<%--嵌套数据绑定--%>
+<form action="${pageContext.request.contextPath}/testBook" method="post">
+    <input type="text" name="bookName" placeholder="请输入书名">
+    <input type="text" name="author.name">
+    <input type="date" name="createTime">
+    <input type="submit" value="提交">
+</form>
+
+
+<%--测试restful风格--%>
+
+<a href="${pageContext.request.contextPath}/book/getBook">book-get</a>
+
+<br>
+<form action="${pageContext.request.contextPath}/book/addBook" method="post">
+    <input type="submit" value="post提交">
+</form>
+
+<br>
+<form action="${pageContext.request.contextPath}/book/updateBook" method="post">
+    <input type="hidden" name="_method" value="put">
+    <input type="submit" value="put提交">
+</form>
+
+<br>
+<form action="${pageContext.request.contextPath}/book/deleteBook" method="post">
+    <input type="hidden" name="_method" value="delete">
+    <input type="submit" value="delete提交">
+</form>
+
+<%--测试原生数据模型--%>
+
+<a href="${pageContext.request.contextPath}/book/testJavaWebModel">testJavaWebModel</a>
+
+
+<%--springmvc模型数据测试--%>
+<a href="${pageContext.request.contextPath}/book/testModelAndView">testModelAndView</a>
+<br>
+<%--测试model数据模型传递--%>
+<a href="${pageContext.request.contextPath}/book/testModel">testModel</a>
+
+
+<%--测试model数据模型传递--%>
+<a href="${pageContext.request.contextPath}/book/testModelMap">testModelMap</a>
+
+<%--测试model数据模型传递--%>
+<a href="${pageContext.request.contextPath}/book/testMap">testMapp</a>
 </body>
 </html>

BIN
springmvc/target/classes/com/sf/conroller/Author.class


BIN
springmvc/target/classes/com/sf/conroller/Book.class


BIN
springmvc/target/classes/com/sf/conroller/BookController.class


BIN
springmvc/target/classes/com/sf/conroller/HelloController.class


BIN
springmvc/target/springmvc.war


BIN
springmvc/target/springmvc/WEB-INF/classes/com/sf/conroller/Author.class


BIN
springmvc/target/springmvc/WEB-INF/classes/com/sf/conroller/Book.class


BIN
springmvc/target/springmvc/WEB-INF/classes/com/sf/conroller/BookController.class


BIN
springmvc/target/springmvc/WEB-INF/classes/com/sf/conroller/HelloController.class


BIN
springmvc/target/springmvc/WEB-INF/lib/activation-1.1.jar


BIN
springmvc/target/springmvc/WEB-INF/lib/commons-fileupload-1.3.3.jar


BIN
springmvc/target/springmvc/WEB-INF/lib/commons-io-2.2.jar


BIN
springmvc/target/springmvc/WEB-INF/lib/jackson-annotations-2.11.3.jar


BIN
springmvc/target/springmvc/WEB-INF/lib/javaee-api-8.0.jar


BIN
springmvc/target/springmvc/WEB-INF/lib/javax.mail-1.6.0.jar


BIN
springmvc/target/springmvc/WEB-INF/lib/joda-time-2.3.jar


+ 3 - 1
springmvc/target/springmvc/WEB-INF/views/result.jsp

@@ -5,12 +5,14 @@
   Time: 14:40
   To change this template use File | Settings | File Templates.
 --%>
-<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" isErrorPage="true" %>
 <html>
 <head>
     <title>结果页</title>
 </head>
 <body>
 <h1>ok...</h1>
+<br>
+${userName}
 </body>
 </html>

+ 35 - 0
springmvc/target/springmvc/WEB-INF/web.xml

@@ -27,6 +27,41 @@
 -->
         <url-pattern>/</url-pattern>
     </servlet-mapping>
+    
+    
+<!--    解决中文乱码问题-->
 
+    <filter>
+        <filter-name>characterEncodingFilter</filter-name>
+        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
+<!--        设置参数-utf-8-->
+        <init-param>
+            <param-name>encoding</param-name>
+            <param-value>UTF-8</param-value>
+        </init-param>
+        <init-param>
+            <param-name>forceEncoding</param-name>
+            <param-value>true</param-value>
+        </init-param>
+        
+    </filter>
+    
+    <filter-mapping>
+        <filter-name>characterEncodingFilter</filter-name>
+<!--        拦截所有-->
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+    
+    
+<!--    配置restful风格的拦截器-->
+    <filter>
+        <filter-name>HiddenHttpMethodFilter</filter-name>
+        <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
+    </filter>
+    <filter-mapping>
+        <filter-name>HiddenHttpMethodFilter</filter-name>
+<!--        拦截所有-->
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
 
 </web-app>

+ 62 - 0
springmvc/target/springmvc/index.jsp

@@ -16,5 +16,67 @@
 
 <a href="${pageContext.request.contextPath}/hello">HelloController</a>
 
+<br>
+<%--测试PathVariable 数据绑定--%>
+<a href="${pageContext.request.contextPath}/testPathVariable/1001">testPathVariable</a>
+
+<br>
+<a href="${pageContext.request.contextPath}/testGet?id=1002&name=admin">testGet</a>
+
+<br>
+<a href="${pageContext.request.contextPath}/testArray?id=1001&id=1002">testArray</a>
+
+<br>
+<a href="${pageContext.request.contextPath}/testPathVariable2/1003/admin">testPathVariable2</a>
+
+<br>
+
+<%--嵌套数据绑定--%>
+<form action="${pageContext.request.contextPath}/testBook" method="post">
+    <input type="text" name="bookName" placeholder="请输入书名">
+    <input type="text" name="author.name">
+    <input type="date" name="createTime">
+    <input type="submit" value="提交">
+</form>
+
+
+<%--测试restful风格--%>
+
+<a href="${pageContext.request.contextPath}/book/getBook">book-get</a>
+
+<br>
+<form action="${pageContext.request.contextPath}/book/addBook" method="post">
+    <input type="submit" value="post提交">
+</form>
+
+<br>
+<form action="${pageContext.request.contextPath}/book/updateBook" method="post">
+    <input type="hidden" name="_method" value="put">
+    <input type="submit" value="put提交">
+</form>
+
+<br>
+<form action="${pageContext.request.contextPath}/book/deleteBook" method="post">
+    <input type="hidden" name="_method" value="delete">
+    <input type="submit" value="delete提交">
+</form>
+
+<%--测试原生数据模型--%>
+
+<a href="${pageContext.request.contextPath}/book/testJavaWebModel">testJavaWebModel</a>
+
+
+<%--springmvc模型数据测试--%>
+<a href="${pageContext.request.contextPath}/book/testModelAndView">testModelAndView</a>
+<br>
+<%--测试model数据模型传递--%>
+<a href="/book/testModel">testModel</a>
+
+
+<%--测试model数据模型传递--%>
+<a href="/book/testModelMap">testModelMap</a>
+
+<%--测试model数据模型传递--%>
+<a href="/book/testMap">testMapp</a>
 </body>
 </html>