ํฐ์คํ ๋ฆฌ ๋ทฐ
package el;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class ElExam01Servlet
*/
public class ElExam01Servlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//elexam01
//ํ๊ธธ๋, ์๋ฅ์ด, ํ ๋ง์ค, ๋ฝ๋ก๋ก ๊ฐ์ฒด๋ค์ ๋ง๋ค์ด์
//Request scope ์ ๋ด๋๋ค.
//๊ทธ๋ฆฌ๊ณ ๋ elExam01.jsp๋ก ํฌ์๋ฉ ํ๋ค.
Toy t1 = new Toy();
t1.setName("๋ฝ๋ก๋ก");
Toy t2 = new Toy();
t2.setName("ํ ๋ง์ค");
Dog d = new Dog();
d.setName("์๋ฅ์ด");
d.setToys(new Toy[]{t1, t2});
Person p = new Person();
p.setDog(d);
p.setName("๊ฐํธ๋");
//์ ์ฅ
request.setAttribute("p", p);
//forwarding
request.getRequestDispatcher("elexam01.jsp").forward(request, response);
}
}
#######################################################################
EL ๊บผ๋ด๊ธฐ
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
์ถ๋ ฅ๋ ๋ด์ฉ:<br/>
${p.name}์ ๊ฐ ${p.dog.name}์ ์ฅ๋๊ฐ์ ${p.dog.toys[0].name} , ${p.dog.toys[1].name} ์ด์ง์.
</body>
</html>
#######################################################################
- Total
- Today
- Yesterday
- ์๋ฐ์คํฌ๋ฆฝํธ
- ์์์ฌ์ด๋
- Java
- ๋ด๋๋ด์ฐ
- Ajax
- ์น์์ด์ ์
- 2ne1
- ์ธํจ์ด
- Servlet
- jQuery
- ์๋ธ๋ฆฟ
- EL
- I Don't Care
- MySQL
- ๊ฒฝ์ ์ฉ์ด
- JSTL
- ๋ณต๊ทผ์ด๋
- asp
- ๋ฉ๋ฐฐํ
- ์๋ฆฌ
- JSP
- ์นด๋ฐ์จ๋ผ์ธ
- ๋์ค
- ํจ์
- ๊ธฐํ
- JSON
- JavaScript
- 8๋ง์ผ
- php
- JS
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
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 |