<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
<%
int total = 0;
for(int i = 1; i <= 10; i++){
total = total + i;
}
%>
A sum of 1 to 10 : <%=total %>
</body>
</html>
JSP is a scripting language that allows us to use Java inside HTML code.
In <% %> or <%= %> area, you can write Java code and when it runs, the code is converted into Servlet.
For example, the code above has <%= total %>. This part will be converted into out.print().
lecture from www.edwith.org
'What I Learned > JSP' 카테고리의 다른 글
JSP Life Cycle (0) | 2019.08.07 |
---|