이미 스프링 프레임 워크를 사용하여 시작하고 이미 내가 (그러나 사실 내가 그것을 해결할 수없는) 나는 보이는 컨트롤러가 바보 같은 문제의 어떤 종류 건너 온 같은 :SpringMVC REST 웹 서비스
package org.springframework.rest;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class SomeController {
@RequestMapping(value = "/", method = RequestMethod.GET)
@ResponseBody
public String returnHtmlPage() {
return "page";
}
}
곳
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>Home</title>
</head>
<body>
<h1>
Hello world!
</h1>
<P> The time on the server is ${serverTime}. </P>
</body>
</html>
하지만 HTML 파일의 insteed 내가에만 문자열 "페이지"반환 페이지 page.jsp입니다. 문제를 어떻게 해결할 수 있습니까?
'@ ResponseBody'를 제거하십시오 :) 그럼 REST 서비스 또는 웹 애플리케이션을 만드시겠습니까? –
나는 그것을 믿을 수 없다! 거의 이것에 썼다! 고마워요, 보리스! 질문에 대해, 지금은 봄 프레임 워크를 발견하고 있습니다.이 후에 REST 서비스를 만들려고합니다. – Mithrand1r