Learn jsp tags and programming | Under Java Training Course

Started by aquanetta, September 22, 2011, 05:23:29 AM

aquanetta

Learn jsp tags and programming | Under Java Training Course

Comments in JSP

Plain HTML Comments
   Ex: <!-- hello --> 
   Response: <! -- hello -->

HTML Comments containing JSP tags
   Ex: < !-- value of 10 + 20 is <%= 10 + 20 %> --> 
   Response: <! -- value of 10 + 20 is 30  -->

JSP Comment tag
   Ex: <%-- This is a JSP comment -- %>
   Response:

Java Comments
   Ex:    <%   /* int x;
            float f;    */
         void meth1()
         {
            //out.println( "hello output" );
         }      %>


JSP tag types

Declaration tags

•   For variable and method declaration
•   
•   Format: <%!    Variable declaration;
            Method declaration;
           %>
Expression tags

•   For inserting Java expressions
•   
•   format: <%= expression %>

Scriptlets
•   To embed java code blocks
•   format: <% code block %>

Directives
•    To specify information that affect
    the whole JSP program
•    format:    <%@ directive_type
       directive_attribute    %>

Action tags
•   Used to work with standard objects
format: <jsp:action_name action_attributes />