JSP tutorial- Declaration Scriptlet Expression tags |
||||||||||||||
JSP (JavaServer Pages)Declaration Scriptlet Expression tagsDeclaration tag (<%! %>)In the declaration tag, you can declare variables and methods. Example: <%! String yourname="Dara Yuk"; String getName(String name){return name;} %>
Scriptlet tag(<%)With Scriptlet tag, you can write your access variables declared in declaration tag. Example: Welcome.jsp <html> <body> <%! String yourname="Dara Yuk"; String getName(String name){ return yourname; } <% out.println("Welcome "+getName(yourname)+"!"); %>
</body> </html>
Expression tag (<%=)In the expression tag, you can embed Java expression. Example: <%=new java.util.Date() %> |
||||||||||||||
|
||||||||||||||