'JSP Optimization'에 해당되는 글 1건
InJSP, you can print out text strings by out.println().
Here's the example.
<HTML> <BODY> <%
// This scriptlet declares and initializes "date"
System.out.println( "Evaluating date now" );
java.util.Date date = new java.util.Date(); %> Hello! The time is now <%
// This scriptlet generates HTML output
out.println( String.valueOf( date )); %> </BODY> </HTML>
But above example can be expressed as below.
<HTML>
<BODY>
<%
// This scriptlet declares and initializes "date"
System.out.println( "Evaluating date now" );
java.util.Date date = new java.util.Date();
%>
Hello! The time is now <%= date%>
</BODY>
</HTML>
<BODY>
<%
// This scriptlet declares and initializes "date"
System.out.println( "Evaluating date now" );
java.util.Date date = new java.util.Date();
%>
Hello! The time is now <%= date%>
</BODY>
</HTML>
Both ways shows the same result, but the second is much faster and have good readability than the first. code,

Prev

Rss Feed