slide-image
728x90

기본 forward

<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<jsp:forward page="/egovSampleList.do"/>

index.jsp

|

EgovSampleController.java

|

egocSampleList.do

 

 

list.jsp 생성

src>main>webapp>WEB-INF>jsp>egovframework>example>board>list.jsp

 

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="<c:url value='css/bootstrap/css/bootstrap.min.css'/>">
<script src="<c:url value='/js/jquery.min.1.11.0.js'/>"></script>
<script src="<c:url value='/css/bootstrap/js/bootstrap.min.js'/>"></script>
<title>Insert title here</title>
</head>
<body>
	<div class="container">
		<h1>메인화면</h1>
		<div class="panel-heading">
			<!-- 로그인 -->
			<form class="form-inline" action="/login.do">
				<div class="form-group">
					<label for="id">ID:</label> <input type="text" class="form-control"
						id="id">
				</div>
				<div class="form-group">
					<label for="pwd">Password:</label> <input type="password"
						class="form-control" id="pwd">
				</div>
				<button type="submit" class="btn btn-default">로그인</button>
			</form>
		</div>
		<div class="panel-body">
			<form class="form-inline" action="/list.do">
				<div class="form-group">
					<label for="searchName">제목(내용):</label> <input type="text"
						class="form-control" id="searchName">
				</div>
				<button type="submit" class="btn btn-default">검색</button>
			</form>

			<!-- 테이블 -->
			<div class="table-responsive">
				<table class="table table-hover">
					<thead>
						<tr>
							<th>Firstname</th>
							<th>Lastname</th>
							<th>Email</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td>John</td>
							<td>Doe</td>
							<td>john@example.com</td>
						</tr>
						<tr>
							<td>John2</td>
							<td>Doe</td>
							<td>john@example.com</td>
						</tr>
						<tr>
							<td>John3</td>
							<td>Doe</td>
							<td>john@example.com</td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
		<div class="pamel-footer">
		<!-- 버튼 -->
		<button type="button" class="btn btn-default">등록</button>
		</div>
	</div>
</body>
</html>

 

spring 기본 구조

java>파일>web

 

컨트롤러 생성

src>main>java>egovframework>example>board>web>BoardController.java

 

BoardController.java

package egovframework.example.board.web;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;



@Controller
public class BoardController {
	@RequestMapping(value = "/list.do")
	public String list(ModelMap model) throws Exception {
		return "board/list";
	}
}

 

index.jsp

- list.do로 수정

<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<jsp:forward page="/list.do"/>

 

728x90
반응형