웹언어/JSP2011. 11. 1. 16:42

Input.jsp


Output.jsp



일단 Form 태그로 데이터를 보내자

Input.jsp
<%@ page language="java" contentType="text/html; charset=euc-kr" pageEncoding="euc-kr"%>
<html>
<head>
<title>REQUEST INPUT</title>
</head>

<body>
<form action="./output.jsp" method="post">
<center>
<table border="0" width="400">
<tr>
<td width="100">이름</td>
<td><input type="text" name="name" /> </td>
</tr>

<tr>
<td>하고싶은말</td>
<td><input type="text" name="text" /> </td>
</tr>

<td colspan="2"><input type="submit" name="btnResult" value="RESULT"/>
<input type="reset" name="btnReset" value="RESET"/></td>
</tr>
</table>
</center>
</form>
</body>
</html>


Output.jsp
<%@ page language="java" contentType="text/html; charset=euc-kr" pageEncoding="euc-kr"%>

<html>
<head>
<title>REQUEST</title>
</head>

<body>
// 자바 string 객체를 이용해서 인코딩을 변경
시작값 : <%=new String(request.getParameter("name").getBytes("8859_1"), "KSC5601") %><br />
종료값 : <%=new String(request.getParameter("text").getBytes("8859_1"), "KSC5601") %>
</bdoy>
</html>







'웹언어 > JSP' 카테고리의 다른 글

page 디렉티브 예제 - info 속성  (0) 2012.08.28
page 디렉티브(Directive) - <%@ page%>  (0) 2012.08.28
서블릿 HelloWorld  (0) 2012.06.04
서블릿(Servlet) 개요  (0) 2012.03.22
Tomcat 설치 + 이클립스  (0) 2012.03.14
Posted by 건깡