[자바JSP서블릿>JSP 스크립틀릿(scriptlet), <% ... %> 요청처리시점에 처리될 하나의 자바코드 블록
요청처리시점에 처리될 하나의 자바코드 블록,<% 와 %>로 둘러 쌓인다.
여러 개의 스크립틀릿은 JSP Page안에 나타나는 순서대로 그대로 컴파일된 클래스 안에 삽입된다.
서블릿으로 보면 service() 메소드 안에서 수행되는 코드의 블록들이라고 할 수 있다.
JSP Page가 요청 될 때 마다 수행된다.
[예제]
<%-- scriptlet.jsp --%>
<%@ page contentType="text/html;
charset=euc-kr" %>
<html>
<body>
<h1> 스크립틀릿
예제</h1>
<%
int sum=0;
for (int i=0;i<5;i++) {
sum += i;
out.println("<b>Loop Test...." + i +
"</b><br>" );
}
out.println("<b>sum = " +
sum);
%>
</body>
</html>
서블릿으로 컴파일된 이후의 파일
// Generated by JRun, do not edit
import javax.servlet.*;
import javax.servlet.http.*;
import
javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import
allaire.jrun.jsp.JRunJSPStaticHelpers;
public class
jrun__jsp__scriptlet2ejsp12 extends allaire.jrun.jsp.HttpJSPServlet implements
allaire.jrun.jsp.JRunJspPage
{
private ServletConfig config;
private ServletContext application;
private Object page = this;
private JspFactory __jspFactory = JspFactory.getDefaultFactory();
public
void _jspService(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException
{
if(config == null) {
config = getServletConfig();
application = config.getServletContext();
}
response.setContentType("text/html; charset=euc-kr");
PageContext pageContext = __jspFactory.getPageContext(this, request, response,
null, true, 8192, true);
JspWriter out =
pageContext.getOut();
HttpSession session =
pageContext.getSession();
int sum = 0;
try {
out.print("\r\n<html>\r\n<body>\r\n<h1> \uc774\uac74
\uc2a4\ud06c\ub9bd\ud2c0\ub9bf \uc608\uc81c\uc785\ub2c8\ub2e4.
</h1>\r\n");
for (int i=0;i<5;i++) {
sum +=
i;
out.println("<b>Loop Test...." + i +
"</b><br>" );
}
out.println("<b>sum =
" + sum);
out.print("\r\n</body>\r\n</html>\r\n");
} catch(Throwable
t) {
if(t instanceof ServletException)
throw
(ServletException) t;
if(t instanceof
java.io.IOException)
throw (java.io.IOException)
t;
if(t instanceof RuntimeException)
throw
(RuntimeException) t;
throw
JRunJSPStaticHelpers.handleException(t, pageContext);
}
finally {
__jspFactory.releasePageContext(pageContext);
}
}
private static final String[] __dependencies__ =
{"/jsp/scriptlet.jsp",null};
private static final long[] __times__ =
{984926063107L,0L};
public String[] __getDependencies()
{
return __dependencies__;
}
public long[]
__getLastModifiedTimes()
{
return __times__;
}
public int __getTranslationVersion()
{
return 13;
}
}
[주말]
[9/28]C#,ASP.NET마스터 [10/5]자바기초에서JSP,Ajax,jQuery,Spring3.2,MyBatis까지 [10/5]SQL초보에서실전전문가까지 [평일야간]
[10/4]자바기초에서JSP,Ajax,jQuery,Spring3.2,MyBatis까지 [10/4]SQL초보에서실전전문가까지 [평일주간]
[10/8]스프링3.X게시판&오라클힌트,SQL튜닝,사례연구 [10/4]PL/SQL,오라클힌트,SQL튜닝,
오라클자바커뮤니티에서 설립한 개발자교육6년차 오엔제이프로그래밍 실무교육센터
(오라클SQL,튜닝,힌트,자바프레임워크,안드로이드,아이폰,닷넷 실무개발강의)
 |
[기업특강]JAVA,JSP,AJAX,jQUERY  | 총 | 5일 | 40시간 | | 10-04 |
스프링3.X게시판&오라클힌트,SQL튜닝,사례연구  | 총 | 4일 | 32시간 | | 10-08 |
Spring3.X, MyBatis, Hibernate실무과정  | 총 | 5일 | 35시간 | | 10-10 |
 |
자바초보에서안드로이드까지  | 총 | 18일 | 54시간 | | 10-04 |
자바기초에서JSP,Ajax,jQuery,Spring3.2,MyBatis까지  | 총 | 24일 | 72시간 | | 10-04 |
스프링3.X게시판&오라클힌트,SQL튜닝,사례연구  | 총 | 11일 | 33시간 | | 10-08 |
JAVA&WEB프레임워크실무과정  | 총 | 33일 | 99시간 | | 10-10 |
Spring3.X, MyBatis, Hibernate실무과정  | 총 | 12일 | 36시간 | | 10-16 |
 |
Spring3.X, MyBatis, Hibernate실무과정  | 총 | 5일 | 35시간 | | 10-05 |
스프링3.X게시판&오라클힌트,SQL튜닝,사례연구  | 총 | 4일 | 32시간 | | 10-05 |
자바기초에서JSP,Ajax,jQuery,Spring3.2,MyBatis까지  | 총 | 10일 | 70시간 | | 10-05 |
자바초보에서안드로이드까지  | 총 | 8일 | 56시간 | | 10-12 |
JAVA&WEB프레임워크실무과정  | 총 | 14일 | 98시간 | | 10-12 |