나는 스프링을 사용하여 페이스 북과 링크되는 App을 생성하고 있습니다. 앱이 실행되면 로그인 페이지로 리디렉션됩니다. 로그인 버튼을 클릭하면 홈페이지로 리디렉션됩니다. 내가 원하는 것은 로그인 버튼을 클릭하면 홈페이지로 리디렉션되고 끝에 고유 번호가 추가됩니다. 내 앱을 실행할 때마다 HTTP 상태 404 오류가 발생합니다. 나는 그 문제가 무엇인지 알 수 없다. 편집 나는 봄 사회 빠른, 내가 만든 유일한 수정을 사용하고있는 프로그램이었다 페이지스프링을 사용하여 컨트롤러에 패스 변수 전달하기
<%@ page session="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>Sign In</title>
</head>
<body>
<c:set var="rand"><%= java.lang.Math.round(java.lang.Math.random() * 2) %></c:set>
<form action="<c:url value="/signin/facebook/${rand}" />" method="POST">
<button type="submit">Sign in with Facebook</button>
<input type="hidden" name="scope" value="email,publish_stream,offline_access" />
</form>
</body>
</html>
홈 페이지
<%@ page session="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>Home</title>
</head>
<body>
<ul>
<li><a href="<c:url value="/signout" />">Sign Out</a></li>
</ul>
<p>${number}</p>
<h3>Your Facebook Friends</h3>
<ul>
<c:forEach items="${friends}" var="friend">
<li><img src="http://graph.facebook.com/<c:out value="${friend.id}"/>/picture" align="middle"/><c:out value="${friend.name}"/></li>
</c:forEach>
</ul>
</body>
</html>
홈 컨트롤러
을에서로그인 아래의 것들
@RequestMapping(value = "/{rand}", method = RequestMethod.GET) public String home(@PathVariable("rand") String rand, Model model) throws IOException { List<Reference> friends = facebook.friendOperations().getFriends(); FacebookProfile profile = facebook.userOperations().getUserProfile(); String userID = facebook.userOperations().getUserProfile().getId(); model.addAttribute("friends", friends); String accessToken = connectionRepository.getPrimaryConnection(Facebook.class).createData().getAccessToken(); System.out.println(accessToken); return "home"; }
어느 URL에서 404를 제공하고 있으며 해당 처리기 방법은 무엇입니까? –
http : // localhost : 8080/my-app /가 오류를 표시합니다. 그냥 "/"요청을 처리하는 컨트롤러가 있어야합니까 ?? 위의 컨트롤러는 내가 가진 유일한 컨트롤러입니다 – IceNine
요구 사항에 따라 로그인 페이지를 나타내는 뷰를 렌더링하여'/'를 처리하는 컨트롤러 메서드가 있어야합니다. –