Search results for 'dead code'. 1 post(s) found.
- 2008/10/27 How to add a declaration on JSP code ?
If you have developed C or C++ program, you may know below examples.
// printf( "a.out");
/*
printf( "b.out");
*/
/*
printf( "b.out");
*/
Above code have no bug, but no code will be compiled, because it's all declarations.
In JSP, you can make declarations as well. In some documents, a declarations is also called as remark.
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 actually dead code, because it;s surrounded with <%! and %>.
Another posts included in "JSP"
| How to set and get sessions on JSP code ? (0) | 2008/10/27 |
| How to resize image ? (0) | 2009/06/03 |
| How to include file in JSP ? (0) | 2008/10/27 |
| How to print out text strings on HTML directly ? (0) | 2008/10/27 |
| Put Date Time on HTML (0) | 2008/10/27 |
| Send An Email Using A Bean (0) | 2007/08/31 |
| JQuery And Function Chaining (0) | 2007/08/31 |

Prev

Rss Feed