본문 바로가기

Web/Spring

Spring Hello 실습

hello.jsp

<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<% String cp = request.getContextPath(); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>헬로우!</title>
</head>
<body>
    <h1>방가방가!</h1>
</body>
</html>


HelloController.java

package kr.or.javac.controller;

import javax.servlet.http.*;

import org.springframework.web.servlet.*;
import org.springframework.web.servlet.mvc.*;

public class HelloController implements Controller {

    public ModelAndView handleRequest(HttpServletRequest arg0,
            HttpServletResponse arg1) throws Exception {
        // viewResolver에 의해서 /WEB-INF/views/hello.jsp 로 간다.
        return new ModelAndView("hello");
    }
}


servlect-context.xml


<beans:bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"></beans:bean>




'Web > Spring' 카테고리의 다른 글

Spring Post 한글 처리 방식  (0) 2012.08.08
Spring DataSource Maven 방식 설정  (0) 2012.08.08
Spring Project Eclipse UTF-8 설정 해주기  (0) 2012.08.07
Spring Template Project 생성  (0) 2012.08.07
Spring 1day ( 예제 )  (1) 2012.08.06