이것은 내 봄 mvc 웹 app.i에서 로그인 화면입니다 가능한 모든 오류 상황을 catch하고 database.like 버그 감지 시스템에 저장할 수 있습니다.결함 추적 웹 스프링 스프링 MVC를 사용하여
예를 들어 사용자가 오류 상태를 채우지 않고 로그인 버튼을 클릭하면 오류 테이블을 저장하지 않아도됩니다.
그리고 암호를 제공하지 않으면 암호가 저장되지 않아야합니다. 사용자가 필드 중 하나를 입력하지 않을 경우 위의 반복 실행, 루프가 데이터베이스에있는 경우 문 3 번 중 하나를 저장할 때
@RequestMapping(value = { "/do-login" }, method = RequestMethod.POST)
public String login(@ModelAttribute(value = "user") User user) {
process(user);
return "success";
}
public void process(User user) {
List<User> users = userService.findAll();
for (User u : users) {
if (!u.getUserName().equals(user.getUserName())) {
IssueDetail detail = new IssueDetail();
detail.setSummary("user name");
detail.setDescription("wrong user name entered");
issueDetailService.save(detail);
} else if (!u.getPassword().equals(user.getPassword())) {
IssueDetail detail = new IssueDetail();
detail.setSummary("password");
detail.setDescription("wrong password entered");
issueDetailService.save(detail);
} else if (!u.getUserType().equalsIgnoreCase(user.getUserType())) {
IssueDetail detail = new IssueDetail();
detail.setSummary("user type");
detail.setDescription("wrong user type entered");
issueDetailService.save(detail);
}
}
}
는 내가 .... 을 위의 코드를 시도했다.
거기에 다른 방법이 있습니다.
테스트 케이스
당신의 루프 대신 처리 방법 내부 코드 행 아래Username password type
-------------------------
N N N =NULL
Y N N = WRONG PASS & TYPE
Y Y N = WRONG TYPE.
N Y Y = WRONG USER.
N N Y = WRONG PASSWORD & TYPE.
그래서 어떤 문제가 있습니까? – RE350