Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- JNDI란
- Project facet java version 10 is not supported
- ServletConfig란
- DataSource 설정
- 애너테이션으로 서블릿에서 초기화
- 자바 웹을 다루는 기술
- 스크립트 요소 예제
- DataSource이란?
- Configure build path
- import 오류
- 서블릿과 오라클 연동
- ConnectionPool이란?
- 세션트래킹 이란
- load-on-startup
- ServletContext 메서드
- 서블릿에서 초기화하는방법
- 쿠키생성위치
- PrepareStatement란?
- 오라클 데이터베이스 접속
- Persistence 쿠키
- 쿠키API
- Tomcat DataSource 설정
- JRE라이브러리 깨짐
- ClassPath 경로
- 이클립스 톰캣 DataSource사용방법
- Session쿠키
- 쿠키실행과정
- web.xml에 load-on-startup 설정
- Statement 단점
- 쿠키 종류
Archives
- Today
- Total
백문이불여일타
[Jsp/Servlet]스크립트요소_내장객체기능(out 내장객체 실습) 본문
out 내장 객체 이용해 데이터 출력하기 예제
1. 실습파일 out1.jsp, out2.jsp 준비한다
2.이름과 나이를 out2.jsp 로 포워딩(=위임)한다
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>데이터입력창</title>
<meta charset="UTF-8">
</head>
<body>
<form method="post" action="out2.jsp">
이름: <input type="text" name="name"><br>
나이: <input type="text" name="age"><br>
<input type ="submit" value="전송">
</form>
</body>
</html>
|
cs |
3.전송된 이름과 나이를 표현식<%=%> 과 out내장객체를 이용해 출력한다
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
32
33
34
35
36
37
38
39
40
41
42
43
|
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding( "utf-8" );
String name=request.getParameter("name");
String age=request.getParameter("age");
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>데이터출력창</title>
</head>
<body>
<%
if(name!=null ||name.length()!=0){
%>
<h1><%=name %> ,<%=age %> </h1>
<%
}else{
%>
<h1>이름을 입력하세요</h1>
<%
}
%>
<%
if(name!=null ||name.length()!=0){
%>
<h1><% out.println(name+" , "+age); %></h1>
<%
}else{
%>
<h1>이름을 입력하세요</h1>
<%
}
%>
</body>
</html>
|
cs |
4. 톰켓실행하여 브라우저에서 요청하여 이름과 나이를 입력한후 전송한다
5. 브라우저에서 전달받은정보를 표현식과 out내장객체로 출력한다
'Jsp' 카테고리의 다른 글
서블릿 비즈니스 처리작업 이란? (0) | 2019.07.19 |
---|---|
[Jsp/Servlet]Jsp페이지 예외처리하기_실습 (0) | 2019.07.11 |
[Jsp/Servlet]스크립트요소_구구단 출력 예제 (0) | 2019.07.10 |
[Jsp/Servlet]스크립트요소_학점 변환 예제 (0) | 2019.07.10 |
[Jsp/Servlet]스크립트요소_로그인예제 (0) | 2019.07.10 |
Comments