Spring
Spring - 파라미터 처리/스프링 프레임워크 작업 환경 최종
우가본
2024. 7. 17. 14:56
스프링 작업 환경 최종!
<script type="text/javascript">
function send1(f) {
let name = f.name.value.trim();
let age = f.age.value.trim();
let tel = f.tel.value.trim();
//입력값 체크
if(name == "") {
alert("이름을 입력하시오.");
f.name.value = "";
f.name.focus();
return;
}
if(age == "") {
alert("나이를 입력하시오.");
f.age.value = "";
f.age.focus();
return;
}
if(tel == "") {
alert("전화번호를 입력하시오.");
f.tel.value = "";
f.tel.focus();
return;
}
f.action="insert1.do";
f.submit();
}
function send2(f) {
let name = f.name.value.trim();
let age = f.age.value.trim();
let tel = f.tel.value.trim();
//입력값 체크
if(name == "") {
alert("이름을 입력하시오.");
f.name.value = "";
f.name.focus();
return;
}
if(age == "") {
alert("나이를 입력하시오.");
f.age.value = "";
f.age.focus();
return;
}
if(tel == "") {
alert("전화번호를 입력하시오.");
f.tel.value = "";
f.tel.focus();
return;
}
f.action="insert2.do";
f.submit();
}
function send3(f) {
let name = f.name.value.trim();
let age = f.age.value.trim();
let tel = f.tel.value.trim();
//입력값 체크
if(name == "") {
alert("이름을 입력하시오.");
f.name.value = "";
f.name.focus();
return;
}
if(age == "") {
alert("나이를 입력하시오.");
f.age.value = "";
f.age.focus();
return;
}
if(tel == "") {
alert("전화번호를 입력하시오.");
f.tel.value = "";
f.tel.focus();
return;
}
f.action="insert3.do";
f.submit();
}
</script>
</head>
<body>
<form>
<table border="1">
<tr>
<th>이름</th>
<td><input name="name" value="홍길동"></td>
</tr>
<tr>
<th>나이</th>
<td><input name="age" value="20"></td>
</tr>
<tr>
<th>전화</th>
<td><input name="tel" value="010-111-1234"></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="낱개로 받기" onclick="send1(this.form)">
<input type="button" value="객체로 받기" onclick="send2(this.form)">
<input type="button" value="Map으로 받기" onclick="send3(this.form)">
</td>
</tr>
</table>
</form>
)낱개로 받기
=> nation 추가 input.html에 추가한 것이 아님.
-> url에 nation값이 넘어가지는 않는다.
)객체로 받기
)Map으로 받기
-> 밑줄 필수!
ip추가 (jsp에도)