我正在嘗試從 jsp 中獲取表單的值以在控制器中的函數(shù)中使用并顯示另一個 jsp<form action="/uc"> <input name="cnp" type="text"> <br> <br> <input type="submit" value="Find"></form>這是我的控制器方法 @RequestMapping(value = "/uc", method = RequestMethod.GET) public String userContracts(@RequestParam("cnp") String cnp, Model model) { List<Contract> ContractList = new ArrayList<Contract>(); ContractList = cl.getContractsOfUser(cnp); model.addAttribute("ContractList", ContractList); System.out.println("In uc"); return "UserContracts"; }
2 回答

呼啦一陣風(fēng)
TA貢獻1802條經(jīng)驗 獲得超6個贊
問題是我必須使用
<form action="http://localhost:8080/SpringWebTemplate/uc.html">
我以前的嘗試要么沒有 .html 要么只使用 /uc

翻過高山走不出你
TA貢獻1875條經(jīng)驗 獲得超3個贊
確保您的包裹在春天到來時被掃描。
在 app-config.xml 文件中檢查下面的標(biāo)簽
上下文:組件掃描基礎(chǔ)包=“com.test.ashok”
添加回答
舉報
0/150
提交
取消