a.jsp
=====================================
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<form action="Test" method="post">
<input type="submit">
</form>
</body>
</html>
Test.java
=================================
package a.b;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class Test
*/
@WebServlet("/Test")
public class Test extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public Test() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
this.doPost(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html; charset=EUC-KR"); //한글출력되도록
PrintWriter out=response.getWriter();
out.println("aaa");
}
}
'개발하자 > JSP&Servlet' 카테고리의 다른 글
ServletContext,ServletConfig (0) | 2015.03.05 |
---|---|
서블릿 한글값 넘기기 (0) | 2015.03.05 |
emp테이블의 ename을 출력하고 클릭하면 상세내용나오게 하기 (0) | 2015.03.01 |
한폼에 submit버튼 두개일 때 이동페이지 설정 (0) | 2015.03.01 |
member테이블 불러와서 내용 수정과 삭제하기 (0) | 2015.03.01 |