黑马程序员技术交流社区
标题:
【成都校区JavaEE24期】}
[打印本页]
作者:
yshshe1700
时间:
2019-6-21 10:58
标题:
【成都校区JavaEE24期】}
import com.itheima.ssm.pojo.Item;
import com.itheima.ssm.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.xml.ws.Action;
@Controller
@RequestMapping("/item")
public class ItemController {
@Autowired
private ItemService itemService;
@RequestMapping("showItem/{id}")
public String findById(@PathVariable("id") int id, Model model){
Item item = itemService.findById(id);
model.addAttribute("item",item);
return "item";
}
}
复制代码
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2