gpt4 book ai didi

java - 尝试显示 jsp 时出现 404 错误

转载 作者:行者123 更新时间:2023-12-02 10:54:14 26 4
gpt4 key购买 nike

我正在尝试从 jsp 获取表单的值以在 Controller 中的函数中使用并显示另一个 jsp

<form action="/uc">
<input name="cnp" type="text">
<br>
<br>
<input type="submit" value="Find">
</form>

这是我的 Controller 方法

 @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";
}

最佳答案

感谢 pedram ezzati 的帮助!

问题是我必须使用

<form action="http://localhost:8080/SpringWebTemplate/uc.html"> 

我之前的尝试要么没有 .html,要么只使用/uc

关于java - 尝试显示 jsp 时出现 404 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51906519/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com