333/NewsController.java

16 lines
509 B
Java

package com.hnucm.springboot.springboot1.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class NewsController {
@RequestMapping("/news/{newsid}")
public String index(@PathVariable String newsid, Model model){
model.addAttribute("newsid",newsid);
return "news.html";
}
}