기본객체(request.out)

서울IT코드정리 /kyChoi·2021년 10월 24일
0

JSP 정리❤

목록 보기
1/22

5단 곱셈을 만들어봐요~

localhost/project1/t1.jsp?n=5

<table>
<%
for(int n = 1 ; n<10; n++){
	 out.print("<tr>");
   	 out.print("<td>"+5+"*"+n+"="+(5*n)+"</td><br/>");
         out.print("</tr>");
}
%>
</table>

URL에 날아온 parameter를 받아요

localhost:8282/project1/t1.jsp?a=100&b=200
이라고 날렸어요~

<%=request.getParameter("a")%><br/> //100
<%=request.getParameter("b")%><br/> //200

localhost:8282/project1/t1.jsp?이름=값&이름=값


"얘를 쿼리문자열~ 이라고 합니다 / 데이터베이스 시간때 배운 쿼리문과는 다릅니다"

url =localhost:8282/project1/t1.jsp?dan=5
	<% String str = request.getParameter("dan");
			int dan = Integer.parseInt(str);
      		        for(int n=1 ; n<10 ; n++){
                        out.print("<tr>");
                        out.print("<td>"+dan+"*"+n+"="+(dan*n)+"</td>");
                        out.print("</tr>");
         					  }
        %>//5 단출력

out, request 톰캣엔진이 알고 있는 객체 -> built in Object 라고 합니다(내장객체)

url =localhost:8282/project1/t1.jsp?id=aa&pw=11
ID: <%=request.getParameter("id")%>
PW: <%=request.getParameter("pw")%>

profile
건물주가 되는 그날까지

0개의 댓글