개발

[java] post로 값 넘기기

지승준 2014. 8. 5. 10:57

Controller.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//javascript
String html = "";
html += "alert('로그인 후 확인이 가능합니다.');";
html += "var f = document.createElement('form');"
html += "f.setAttribute('method','post');";
html += "f.setAttribute('action','../login/login.do');";
html += "document.body.appendChild(f);";
html += "var i = document.createElement('input');";
html += "i.setAttribute('type','hidden');";
html += "i.setAttribute('name','direct');";
html += "i.setAttribute('value','/qna/list.do?gubun=" + gubun +"');";
html += "f.appendChild(i);";
html += "f.submit();";
modelMap.put("check", html);
 
return "login/check";
cs

check.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<%@ 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="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
 
</body>
<script type="text/javascript">
    ${check}
</script>
</html>
cs


'개발' 카테고리의 다른 글

[javascript] 페이지 로딩시 시작 제이쿼리  (0) 2014.08.09
[java] 현재날짜  (0) 2014.08.05
[java] Spring Beans Problem 오류  (0) 2014.07.31
[javascript] 페이스북 api 연동  (0) 2014.07.23
[javascript] 지정 시간 후 실행  (0) 2014.07.14