강의노트/Spring
관련 글 17
[exception]CommonExceptionResolver.java
강의노트/Spring
2013. 9. 4. 12:01
@Componentpublic class CommonExceptionResolver extends SimpleMappingExceptionResolver {@AutowiredMessageSource msg; @Overrideprotected ModelAndView doResolveException(HttpServletRequest request,HttpServletResponse response, Object handler, Exception ex) {// TODO Auto-generated method stubModelAndView mv = new ModelAndView();String url="";if(ex instanceof LoginException){//ex가 LoginException에 대한 ..
[WEB-INF]servlet-context.xml
강의노트/Spring
2013. 9. 4. 11:59
infrastructure --> in the /WEB-INF/views directory --> class="org.springframework.web.servlet.view.InternalResourceViewResolver"> up static resources in the ${webappRoot}/resources directory --> class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
[controller]UserController.java
강의노트/Spring
2013. 9. 4. 11:56
@Controller public class UserController { @Autowired IUserService userService; @RequestMapping(value="/", method=RequestMethod.GET) public String moveLoginPage(){ return "loginForm"; } @RequestMapping(value="/login.action", method=RequestMethod.POST) public String checkLogin(@ModelAttribute UserInfo user, Model model) throws SQLException, LoginException{ //사용자의 정보가 있는지 조회를 하는 기능을 호출 UserInfo uIn..
[service]UserServiceImpl.java
강의노트/Spring
2013. 9. 4. 11:55
@Service("userService")public class UserServiceImpl implements IUserService {@AutowiredIUserDao userDao; @Overridepublic UserInfo findUserInfo(UserInfo user) throws SQLException {// TODO Auto-generated method stubUserInfo uInfo = userDao.findUserInfo(user);if(uInfo==null){//ID없음uInfo = user;}else if(uInfo.getUser_pass() != user.getUser_pass()){//비밀번호 불일치uInfo.setResult(UserInfo.NOT_MATCH_PASS);}..
[service]IUserService.java
강의노트/Spring
2013. 9. 4. 11:55
public interface IUserService {public UserInfo findUserInfo(UserInfo user) throws SQLException;public UserInfo insertUserInfo(UserInfo user) throws SQLException;public int updateUserInfo(UserInfo user) throws SQLException;public int deleteUserInfo(UserInfo user) throws SQLException;}
[dao]UserDaoImpl.java
강의노트/Spring
2013. 9. 4. 11:52
@Repository("userDao")public class UserDaoImpl implements IUserDao {@AutowiredSqlMapClientTemplate sqlMapClientTemplate;@AutowiredUserInfo user_info;@Overridepublic UserInfo findUserInfo(UserInfo user) throws SQLException {// TODO Auto-generated method stubUserInfo uInfo = (UserInfo)sqlMapClientTemplate.queryForObject("find_userinfo", user);return uInfo;} @Overridepublic UserInfo insertUserInfo(..
[dao]IUserDao.java
강의노트/Spring
2013. 9. 4. 11:50
public interface IUserDao { public UserInfo findUserInfo(UserInfo user) throws SQLException; public UserInfo insertUserInfo(UserInfo user) throws SQLException; public int updateUserInfo(UserInfo user) throws SQLException; public int deleteUserInfo(UserInfo user) throws SQLException; }
[resources]user_query.xml
강의노트/Spring
2013. 9. 4. 11:48
select * from p_userinfowhere 1=1user_id = #user_id#user_name = #user_name#insert into p_userinfo(user_id, user_pass, user_name, user_address, user_phone, user_email, user_sex, user_age)values(#user_id#, #user_pass#, #user_name#, #user_address#, #user_phone#, #user_email#, #user_sex#, #user_age#)update p_userinfo set user_pass="#user_pass#", user_name="#user_name#", user_address="#user_address#"..