😁 formtest1
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="../css/public.css" type="text/css">
<style>
span{
display : inline-block; /*span에 가로세로를 주려면 인라인과 블럭을 같이 사용해야함 */
width : 100px;
height : 30px;
/* border-bottom : 1px dotted gold; */
}
form{
width : 300px;
border : 1px solid blue;
height : 200px;
padding : 20px;
}
</style>
</head>
<body>
<pre>
전송을 하면 서버의 실행페이지를 요청해서 실행후 응답 받는다
<form action="formsend1.jsp" method="post">
action="formsend1.jsp" : 전송시 서버내의 실행 페이지 이름 - jsp 또는 서블릿 클래스 파일
method="post" : 전송방식
</pre>
<form action="formsend1.jsp" method="post">
<span>이름</span>
<input type="text" name="name"> <br>
<span>비밀번호</span>
<input type="password" name="pass"> <br>
<span>아이디</span>
<input type="text" name="id"> <br>
<span>전화번호</span>
<input type="text" name="tel"> <br>
<span>이메일</span>
<input type="text" name="email"> <br>
<input type="submit" value="전송">
</form>
</body>
</html>
😁 formsend1
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
h1{
color : red;
text-align : center;
}
p{
font-size : 1.5em;
text-align : center;
}
table{
border : 2px solid blue;
margin : 20px auto;
}
td{
width : 200px;
height : 50px;
text-align : center;
}
</style>
</head>
<body>
<h1>JSP : Java Server page</h1>
<p>서버내에서 실행되는 자바 프로그램</p>
<p>html코드와 자바코드를 같이 기술한다.</p>
<p>자바코드를 기술하기 위해서는 <% %> 기호가 필요하다</p>
<%
request.setCharacterEncoding("UTF-8");
String userName = request.getParameter("name");
String userId= request.getParameter("id");
String userPass = request.getParameter("pass");
String userMail = request.getParameter("email");
String userTel = request.getParameter("tel");
// DB연결해서 CRUD처리를 수행하고 결과값을 발생
// 결과값으로 클라이언트쪽으로 응답
%>
<table border="1">
<tr>
<td>이름</td>
<td><%= userName %></td>
</tr>
<tr>
<td>아이디</td>
<td><%= userId %></td>
</tr>
<tr>
<td>이메일</td>
<td><%= userMail %></td>
</tr>
<tr>
<td>전화번호</td>
<td><%= userTel %></td>
</tr>
</table>
</body>
</html>
😁 참고자료






😁 실행


'웹프로그래밍(HTML, CSS3, JavaScript)' 카테고리의 다른 글
[HTML&Script] formtest2 (0) | 2022.12.23 |
---|---|
[HTML&Script] buttonproc (0) | 2022.12.23 |
[HTML & Script] videotest (0) | 2022.12.23 |
[HTML & Script] audiotest (0) | 2022.12.22 |
[HTML& Script] div와 span (0) | 2022.12.22 |