다음 URL은 GET 메소드를 사용하여 HelloForm 프로그램에 두 개의 값을 전달합니다.
href="https://localhost:8080/main.jsp?first_name=ZARA&last_name=ALI"
아래는 main.jsp입니다. 웹 브라우저에서 제공한 입력을 처리하는 JSP 프로그램입니다. getParameter()를 사용할 것입니다. 전달된 정보에 매우 쉽게 액세스할 수 있는 방법 -
<html>
<head>
<title>Using GET Method to Read Form Data</title>
</head>
<body>
<h1>Using GET Method to Read Form Data</h1>
<ul>
<li><p><b>First Name:</b>
<%= request.getParameter("first_name")%>
</p></li>
<li><p><b>Last Name:</b>
<%= request.getParameter("last_name")%>
</p></li>
</ul>
</body>
</html> 이제 href="https://localhost:8080/main.jsp?first_name=ZARA&last_name=ALI"를 입력합니다. 브라우저의 Location:box에서 . 이것은 다음과 같은 결과를 생성합니다 -
GET 메소드를 사용하여 양식 데이터 읽기
|