我有一个控制器有 2 个这样的动作:
@Controller
@RequestMapping("xyzlogin")
public class XyzloginController
{
@RequestMapping(method = RequestMethod.GET)
public ModelAndView showForm(HttpServletRequest request, ModelMap model)
{
//.... do something....
}
@RequestMapping(value = "/requestXYZ", method = RequestMethod.GET)
public ModelAndView requestXYZ(HttpServletRequest request, ModelMap model)
{
//.... do something with parameter param1.
}
}
在视图文件中,我有以下方法来请求此控制器中的操作:
<a href="requestXYZ?param1=abc">Click me to call requestXYZ action</a>
如上例所述,单击超链接后,我想调用 requestXYZ 操作,但我收到 404 错误,说它找不到映射。
我定义映射错误吗?什么是正确的映射?
谢谢,