JAVA 서브렛/JSP P157 연습문제
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>お問い合わせフォーム</title>
</head>
<body>
<form action="sample02/Ex1" method="post">
名前:<br> <input type="text" name="name"><br>
お問い合わせの種類:<br> <select name="qtype">
<option value="company">会社について</option>
<option value="product">製品について</option>
<option value="support">アフターサポートについて</option>>
</select> <br> お問い合わせ内容:<br>
<textarea name="body">
</textarea>
<br> <input type="submit" value="登録">
</form>
</body>
</html>
▪️Ex1.java Servletimport java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/Ex1")
public class Ex1 extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
String name = request.getParameter("name");
}
}
▪️sample02.jsp 실행 결과▪JSP 파일을 직접 재생할 수 없는 방법
WEB-INF 디렉토리 아래에 JSP 파일 구성
Reference
이 문제에 관하여(JAVA 서브렛/JSP P157 연습문제), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/icelandnono/items/4d4e1e11c2da9b5640b7텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)