用Java三大框架混合开发时,有这个方法,但是在页面转移是显示资源不存在 5
13:10:56.781[http-8080-5]DEBUGo.s.o.h.s.OpenSessionInViewFilter-UsingSessionFactory's...
13:10:56.781 [http-8080-5] DEBUG o.s.o.h.s.OpenSessionInViewFilter - Using SessionFactory 'sessionFactory' for OpenSessionInViewFilter
13:10:56.781 [http-8080-5] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'sessionFactory'
13:10:56.781 [http-8080-5] DEBUG o.s.o.h.s.OpenSessionInViewFilter - Opening single Hibernate Session in OpenSessionInViewFilter
13:10:56.781 [http-8080-5] DEBUG o.s.o.hibernate3.SessionFactoryUtils - Opening Hibernate Session
13:10:56.781 [http-8080-5] DEBUG org.hibernate.impl.SessionImpl - opened session at timestamp: 5359807106174976
13:10:56.781 [http-8080-5] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'dispatch' processing POST request for [/crm/crm/customer/metaCustomer/]
13:10:56.796 [http-8080-5] WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/crm/crm/customer/metaCustomer/] in DispatcherServlet with name 'dispatch'
13:10:56.796 [http-8080-5] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
13:10:56.796 [http-8080-5] DEBUG o.s.o.h.s.OpenSessionInViewFilter - Closing single Hibernate Session in OpenSessionInViewFilter
13:10:56.796 [http-8080-5] DEBUG o.s.o.hibernate3.SessionFactoryUtils - Closing Hibernate Session
代码如下:
@RequestMapping("/metaCustomer/{id}")
public String metaCustomer(@PathVariable
String id,ModelMap model) {
//System.out.println("==========a=========");
Customer customer = customerService.getCustomer(id);
model.addAttribute("customer", customer);
List<UserWrap> userWraps = new ArrayList<UserWrap>();
List<User> allUsers = userService.queryAllUer();
Set<User> users = customer.getUsers();
for (User user : allUsers) {
String userId = user.getId();
UserWrap userWrap = new UserWrap();
userWrap.setUser(user);
for (User temp : users) {
if (userId.equals(temp.getId())) {
userWrap.setDistribute(true);
System.out.println("temp.getName()========"+temp.getName());
}
}
userWraps.add(userWrap);
}
model.addAttribute("users", userWraps);
return "/customer/metaCustomer";
} 展开
13:10:56.781 [http-8080-5] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'sessionFactory'
13:10:56.781 [http-8080-5] DEBUG o.s.o.h.s.OpenSessionInViewFilter - Opening single Hibernate Session in OpenSessionInViewFilter
13:10:56.781 [http-8080-5] DEBUG o.s.o.hibernate3.SessionFactoryUtils - Opening Hibernate Session
13:10:56.781 [http-8080-5] DEBUG org.hibernate.impl.SessionImpl - opened session at timestamp: 5359807106174976
13:10:56.781 [http-8080-5] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'dispatch' processing POST request for [/crm/crm/customer/metaCustomer/]
13:10:56.796 [http-8080-5] WARN o.s.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/crm/crm/customer/metaCustomer/] in DispatcherServlet with name 'dispatch'
13:10:56.796 [http-8080-5] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
13:10:56.796 [http-8080-5] DEBUG o.s.o.h.s.OpenSessionInViewFilter - Closing single Hibernate Session in OpenSessionInViewFilter
13:10:56.796 [http-8080-5] DEBUG o.s.o.hibernate3.SessionFactoryUtils - Closing Hibernate Session
代码如下:
@RequestMapping("/metaCustomer/{id}")
public String metaCustomer(@PathVariable
String id,ModelMap model) {
//System.out.println("==========a=========");
Customer customer = customerService.getCustomer(id);
model.addAttribute("customer", customer);
List<UserWrap> userWraps = new ArrayList<UserWrap>();
List<User> allUsers = userService.queryAllUer();
Set<User> users = customer.getUsers();
for (User user : allUsers) {
String userId = user.getId();
UserWrap userWrap = new UserWrap();
userWrap.setUser(user);
for (User temp : users) {
if (userId.equals(temp.getId())) {
userWrap.setDistribute(true);
System.out.println("temp.getName()========"+temp.getName());
}
}
userWraps.add(userWrap);
}
model.addAttribute("users", userWraps);
return "/customer/metaCustomer";
} 展开
3个回答
2017-08-28
展开全部
struts做页面效果的。spring做业务逻辑的。hibernate做数据持久层的。jsp页面请求提交给struts的action类的方法,在action方法中调用spring的业务代码,spring代码将处理后的数据持久层存到数据库。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2017-08-28
展开全部
在form的属性里面加上target="_top"就可以了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
No mapping found for HTTP request with URI [/crm/crm/customer/metaCustomer/]
明白没?
明白没?
追问
这个我知道,但是怎么解决呢
追答
uri错了啊 你的request url 正确的应该是/crm/customer/metaCustomer/ 你现在多了个crm 问题在于哪里 这个坐你贴上来的看不出来
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询