spring - 返回 ModelAndView 不适用于用户定义的函数
问题描述
返回 ModelAndView 对象不适用于用户定义的函数这是我的代码
@Controller
public class HelloController {
@RequestMapping(value="/welcome",method = RequestMethod.GET)
public ModelAndView hello(){
ModelAndView model = new ModelAndView("index");
model.addObject("msg", "checking ModelAndView return!!!");
return model;
}
}
解决方案
而不是使用 import org.springframework.web.servlet.ModelAndView;
我用过 import org.springframework.web.portlet.ModelAndView; 这就是问题所在
推荐阅读
- reactjs - React useEffect 抛出错误:无法对未安装的组件执行 React 状态更新
- python - 用 HoughCircles 找不到欲望圈
- python - 无法同时使用 .openssh 密钥和密码通过 Paramiko 连接到 SFTP
- reactjs - 反应来自另一个组件的触发组件
- traffic - 蝗虫 - 从 RPS 方程中提取响应时间?
- html - 在 Django 中创建轮播滑块的问题
- c# - 使用 System.Drawing.Graphics 进行地图投影
- python - Airflow DAG 脚本在日志中打印值
- javascript - 包含重复值的数组
- sql - 如何在 sql server 中使用 select * 和 group by 子查询