How to add a declaration on JSP code ? | |||
| |||
// printf( "a.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> Above code is actually dead code, because it;s surrounded with <%! and %>. Tags: Display JSP session control session session.getAttribute | |||
| |||
| |||
Login for comment |
SIMILAR POSTS How to include file in JSP ? |
OTHER POSTS IN THE SAME CATEGORY How to resize image ? |