SSM框架controller层不跳转页面,controller的方法也没加responsebody,但是就是不跳转页面,怎么办啊?


  • <!-- 前端控制器 -->
    springmvc
    org.springframework.web.servlet.DispatcherServlet
    <!-- 配置文件路径 -->

    contextConfigLocation
    classpath:spring/spring-*.xml



    springmvc
    /

    上面是servlet的配置





    上面是视图解析器的配置

@Controller
@RequestMapping("/user")
public class UserController {
@Autowired
private UserService userServiceImpl;

/**
 *   登录功能
 */
@RequestMapping("/isLogin")
public String isLogin(User userData,HttpSession session) {
    User user = null;
    user = userServiceImpl.queryByUserName(userData.getUserName());
    if(user == null) {
        session.setAttribute("false", "用户名或密码错误");
        //return "redirect:/user/isLogin";
    }
    return "index";
}

}
上面是controller的代码,这是我做的登录功能

我感觉这些都对,但是就是不跳转页面,求各位大牛帮我一下,在此先谢过

有没有报错,如果没报错我猜测你根本没进这个方法。前台你是怎么调用的。前台跳转应该用user/isLogin

1、检测下返回视图有没有加前缀和后缀;
2、有没有进入控制层方法;
3、有没有报错。

老弟,你要根据最后返回的index跳转,你的返回类型应该是modelAndView把,你这个字符串是几个意思?