미해결
스프링 MVC 1편 - 백엔드 웹 개발 핵심 기술
2 hello-서블릿에서 웹 브라우져에 내용이 보이지 않음.
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { super.service(request, response); System.out.println("Helloservlet.service"); System.out.println("request = " + request); System.out.println("response = " + response); String username = request.getParameter("username"); System.out.println("username = " + username); response.setContentType("text/plain"); response.setCharacterEncoding("utf-8"); response.getWriter().write("hello " + username );}
위와 같이 작성하였으며, 콘솔에는 아래와 같이 보이나.
Helloservlet.service
request = org.apache.catalina.connector.RequestFacade@3561983a
response = org.apache.catalina.connector.ResponseFacade@5c60947
username = "scmoon"
웹브라우져에서는 오류가 납니다.
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Tue Jul 20 19:02:15 KST 2021
There was an unexpected error (type=Method Not Allowed, status=405).