requestTest1.jsp > MODEL

본문 바로가기
사이트 내 전체검색

MODEL

requestTest1.jsp

페이지 정보

profile_image
작성자 관리자
댓글 0건 조회 736회 작성일 21-07-15 18:39

본문

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>


<%@ page import = "java.util.Enumeration" %>    

<%request.setCharacterEncoding("UTF-8");%>


<html>

<head>

<title>Request Test</title>

<style>

h1 {

text-align: center;

}


table {

margin: auto;

width: 400px;

border: 1px solid red;

}

</style>

</head>

<body>

<h1>Request 예제입니다.</h1>

<table>

<tr>

<td>이름</td>

<td><%=request.getParameter("name") %></td>

</tr>

<tr>

<td>성별</td>

<td>

<%if(request.getParameter("gender").equals("male")) {%> 남자

<%} else {%>여자<%} %>

</td>

</tr>

<tr>

<td>취미</td>

<td>

<%

if(request.getParameter("hobby") != null){

String[] hobby=request.getParameterValues("hobby");

for(int i=0;i<hobby.length;i++){

%>

<%=hobby[i]%>&nbsp;&nbsp;

<%

}

}

%>

</td>

</tr>

<tr>

<td>취미2</td>

<td>

<%

// Enumeration 인터페이스 정리

// 객체들의 집합(Vector)에서 각각의 객체들을 한순간에 하나씩 처리할 수 있는 메소드를 제공하는 켈렉션이다.

// Enumeration 인터페이스 메소드들 (아래 2개)

// hasMoreElements() : Vector로 부터 생성된 Enumeration의 요소가 있으면 true, 아니면 false 반환

// nextElement() : Enumeration 내의 다음 요소를 반환한다. 


Enumeration e=request.getParameterNames();

while(e.hasMoreElements()){

String name = (String)e.nextElement();

if(name.startsWith("pkt")){

String value = request.getParameter(name);

out.print(value+"&nbsp;&nbsp;&nbsp;");

}

}

%>

</td>

</tr>

<tr>

<td>취미3</td>

<td>

<%

String aaa1 = request.getParameter("aaa1");

String aaa2 = request.getParameter("aaa2");

String aaa3 = request.getParameter("aaa3");

String aaa4 = request.getParameter("aaa4");

String aaa5 = request.getParameter("aaa5");

out.print("aaa1 : "+aaa1+"<br>");

out.print("aaa2 : "+aaa2+"<br>");

out.print("aaa3 : "+aaa3+"<br>");

out.print("aaa4 : "+aaa4+"<br>");

out.print("aaa5 : "+aaa5+"<br>");

%>

</td>

</tr>

</table>

</body>

</html>

추천0

댓글목록

등록된 댓글이 없습니다.

회원로그인

회원가입

사이트 정보

공지사항
자유게시판
질문답변
1:1문의

 

별명 : 터푸가위
주소 : 부산시 동래구 명장로20번길 90
대표 : 박규태
메일 : dancepkt@******.com

접속자집계

오늘
144
어제
181
최대
10,760
전체
284,056
Copyright © dancePKT . All rights reserved.