yusm 6 hónapja
szülő
commit
9fa68f6578

+ 3 - 6
fhKeeper/formulahousekeeper/webttkuaiban/src/main/java/com/firerock/webttkuaiban/demos/controller/ArticleTemplateController.java

@@ -8,10 +8,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.*;
 
 import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
@@ -28,7 +25,7 @@ public class ArticleTemplateController {
     ArticleService articleService;
 
     @GetMapping("/pageList/{pageIndex}")  // 这里的 PageBean 是事先定义好的实体类
-    public Object PageList(Model model, Integer pageIndex, @RequestParam(required = false) String info)
+    public Object PageList(Model model, @PathVariable("pageIndex") Integer pageIndex, @RequestParam(required = false) String info)
     {
         Integer pageSize=10;
         // 定义格式化器
@@ -65,7 +62,7 @@ public class ArticleTemplateController {
         return "articleList";
     }
     @GetMapping("/articleDetail/{id}")  // 这里的 PageBean 是事先定义好的实体类
-    public Object articleDetail(Model model,Integer id)
+    public Object articleDetail(Model model,@PathVariable("id") Integer id)
     {
         // 定义格式化器
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");