'remark'에 해당되는 글 1건
- 2008/10/27 How to add a declaration on JSP code ?
// printf( "a.out");
/*
printf( "b.out");
*/
/*
printf( "b.out");
*/
Above code have no bug, but no code will be compiled, because it's alldeclarations.
In JSP, you can make declarations as well. In some documents, a declarations is also called asremark.
To add a declaration, you must use the <%! and %> sequences to enclose your declarations, as shown below.
<%@ page import="java.util.*" %>
<HTML>
<BODY>
<%!
Date theDate = new Date();
Date getDate()
{
System.out.println( "In getDate() method" );
return theDate;
}
%>
Hello! The time is now <%= getDate() %>
</BODY>
</HTML>
<HTML>
<BODY>
<%!
Date theDate = new Date();
Date getDate()
{
System.out.println( "In getDate() method" );
return theDate;
}
%>
Hello! The time is now <%= getDate() %>
</BODY>
</HTML>
Above code is actuallydead code, because it;s surrounded with <%! and %>.

Prev

Rss Feed