티스토리 뷰
(기초)그래서 뭘 배운거야?/JSP
JSP-09-getContextPath() : 주소경로 Path만 가져오기 / getParameterValues() : 다중 Value값 받아오기
Soheny.P 2021. 11. 5. 10:33728x90
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
/* request.getParameterValues : 복수개의 value값을 받아서 가져올 때 */
String[] str = request.getParameterValues("sel");
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%for(int i=0; i < str.length; i++){ %>
<p><%=str[i] %></p>
<%} %>
</body>
</html>
<%@ 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>
</head>
<body>
<h1>복수개 데이터 받기</h1>
<!-- request.getContextPath() : 프로젝트 Path부분만 가져옴 -->
<!-- ex : http://localhost:8080/project/list.jsp 에서 /project부분 -->
<form action="<%=request.getContextPath() %>/ch06/example1_1.jsp">
<ul>
<li><label for="sel1">선택1</label><input type="checkbox" name="sel" id="sel1" value="sel1" /></li>
<li><label for="sel2">선택2</label><input type="checkbox" name="sel" id="sel2" value="sel2" /></li>
<li><label for="sel3">선택3</label><input type="checkbox" name="sel" id="sel3" value="sel3" /></li>
<li><button>전송</button></li>
</ul>
</form>
</body>
</html>
728x90
'(기초)그래서 뭘 배운거야? > JSP' 카테고리의 다른 글
JSP-10-a href / forward / sendRedirect : 다른 페이지로 데이터 보내기 (0) | 2021.12.02 |
---|---|
JSP-08-request.setAttribute()/getAttribute() : 데이터 설정, 받아오기 (0) | 2021.11.01 |
JSP-07-response.sendRedirect() / pageContext.forward() : 페이지 이동하기 (0) | 2021.11.01 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 정처기
- 정보처리기사실기
- html
- 복습
- definition List
- 비전공
- tabletag
- ol>li
- 단락태그
- 93점
- emtag
- tablespan
- hn태그
- pretag
- imgtag
- 정보처리기사
- spantag
- 정보처리기사필기
- ptag
- marktag
- usemap
- hr tag
- 긴문장
- 줄글
- 2021년2회
- 합격
- ul>li
- 2021년42회
- boldtag
- br tag
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함