【发布时间】:2015-05-06 09:33:03
【问题描述】:
我在 jsp 中有一个下拉菜单,我使用 @modelAttribute 从数据库中填充数据。但是,每当 url 在该 url 执行模型属性代码运行之前命中并意外命中数据库时......是否有任何方法可以避免这种情况...... 我的代码是
@ModelAttribute("courseList")
public Map<String, String> gerCourseNameList(HttpSession session,
HttpServletRequest httpSevletRequest, HttpServletResponse response,
ModelMap model) throws IOException {
Map<String, String> map = null;
------ My code here------
}
我的日志文件在这里
[DEBUG] SessionFilter| Url :http://localhost:8080/EnKalviV1/studentallocation.htm
[06 May 2015 15:01:11] [Inst Id: INS | Branch Id: BR001 | User Id: bradm1 | Session Id: 97910CBDA9FF68175302717842E9923F]
[DEBUG] LoggingAspect| Class Name :com.jaw.student.controller.StudentAllocationController,Calling gerCourseNameList() method.
[06 May 2015 15:01:11] [Inst Id: INS | Branch Id: BR001 | User Id: bradm1 | Session Id: 97910CBDA9FF68175302717842E9923F]
即使对于该控制器中的 ajax 调用,此代码也在运行...
如何避免这种情况......
【问题讨论】:
-
localhost:8080/EnKalviV1/studentallocation.htm这个url必须映射到一个方法?请发布剩余的课程代码
标签: java spring modelattribute