我们进行了ssm的初步学习,首先便是关于maven,管理我们的jar包的,把镜像改为阿里云的镜像,并开始下载jar包。
再编写application启动,确定端口以及与数据库的连接
最后编写controller进行控制
import com.zhongruan.bean.User; import com.zhongruan.service.IUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @Controller @RequestMapping("/user") public class UserController { @Autowired private IUserService userService; @RequestMapping("/login.do") public ModelAndView login(User user){ boolean flag = userService.login(user.getUsername(), user.getPassword()); ModelAndView modelAndView=new ModelAndView(); if(flag){ modelAndView.setViewName("../ok"); }else { modelAndView.setViewName("../failure"); } return modelAndView; } }