
Test1.
๐ป ์ ๋ ฅ
<%@ page contentType="text/html; charset=UTF-8"%>
<%
int a=10, b=5, c;
c = a + b;
%>
<!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=UTF-8">
<title>Insert title here</title>
</head>
<body>
</body>
ํฉ: <%=a%>+<%=b %>=<%=c %><br/>
<%
out.print("ํฉ: " + a + "+" + b + "=" + c + "<br/>");
String str = String.format("ํฉ: %d+%d=%d<br/>",a,b,c);
out.print(str);
%>
</html>
๐ ์ถ๋ ฅ


์๋ธ๋ฆฟ์ ๊ฐ์ฒด (๋ด์ฅ๊ฐ์ฒด)
ํ์ด์ง ์์ค๋ณด๊ธฐ


โผ html์์ญ์์์๋ jsp์์ญ์ ๋ง๋ค๊ณ ์ถ์ผ๋ฉด

Test2.
๐ป ์ ๋ ฅ
ํฐ์บฃ & ์ดํด๋ฆฝ์ค ๊ณต์ฉ๊ณต๊ฐ
C:\java\work.metadata.plugins\org.eclipse.wst.server.core\tmp0\work\Catalina\localhost\study\org\apache\jsp\jsp1
C:\java\work\study\WebContent
C:\java\work.metadata.plugins\org.eclipse.wst.server.core\tmp0\work\Catalina\localhost\study
์ด study๊ฐ
์ฃผ์
http://192.168.16.16:8080/study/jsp1/test1.jsp
์ฌ๊ธฐ study์








โญโญโญ



Test3.
๐ป ์ ๋ ฅ
๐ ์ถ๋ ฅ
<%@ page contentType="text/html; charset=UTF-8"%>
<%!
int a = 0;
int sum(int x){
int s=0;
for(int i=1; i<=x; i++){
s+=i;
}
return s;
}
%>
<%
int b = 0;
a++;
b++;
%>
<!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=UTF-8">
<title>Insert title here</title>
</head>
<body>
a: <%=a %><br/>
b: <%=b %><br/>
ํฉ: <%=sum(100) %>
</body>
</html>
