728x90
반응형
03_01_scriptlet01.jsp
03_01_scriptlet01.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<%
		int a = 2, b = 3;
		int sum = a + b;
		out.println("2 + 3 = " + sum + "<br>");
		
		int z = 7;
		out.println("a + z = " + (a+z));
	%>
</body>
</html>​

 

03_01_scriptlet02.jsp
03_01_scriptlet02.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
table {
border-collapse : collapse;
width : 50%;}

td {
border: 1px solid #000;}
</style>
</head>
<body>
	<%
	for(int i = 0; i <= 10; i++){
		if (i % 2 == 0)
			out.println(i + "<br>");
	}
	%>
	<table>
	<% for(int i = 0; i <= 10; i++) { %>
	<tr id="tr<%=i%>">
		<td><%=i %></td>
		<td><%=i %></td>
		<td><%=i %></td>
	</tr>
	<% } %>
	</table>
</body>
</html>​

 

728x90
반응형

+ Recent posts