SetNameServlet.java
페이지 정보
본문
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;
import javax.servlet.http.HttpSession;
@WebServlet("/setName")
public class SetNameServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public SetNameServlet() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession();
session.setAttribute("name","박규태");
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("<h1>이름저장</h1>");
}
}
- 이전글● 간단한 세션 예제 21.07.15
- 다음글GetNameServlet.java 21.07.15
댓글목록
등록된 댓글이 없습니다.