Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Scripting Elements in JSP

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 193
    Comment on it

    Scripting Elements : In JSP every scripting element is written inside the <% %> tags. At the translation phase JSP engine reads the code inside the <% %> tags and processed it. In a JSP file outside this <% %> tag all code is treated as HTML or simple text.

    App.jsp

    <html>
        <head>
            <title>Simple JSP Page</title>
        </head>
       <%
           int counter = 0;
       %>
      <body>
            Total Users : <% out.println(++counter); %>   
      </body>
    </html>
    

    JSP has the following scripting elements :

    1. Comment
    2. Directive
    3. Declaration
    4. Scriptlet
    5. Expression

    JSP comments : At the time of creating the JSP page and you have some code where you want to add some comment then you can use JSP comment tags. At the time of translation phase the code inside the comment tag will be ignored. So the JSP comment is only for the jsp page. Following is the syntex of the JSP comment:

    <%-- JSP comment --%>
    

    Example of JSP comment : Following is the sample code to show the JSP comment on page.

    App.jsp

    <html>
        <head>
            <title>Simple JSP Page</title>
        </head>
       <%
           int counter = 0;
       %>
      <body>
             <%-- This is showing total number of users  --%>
            Total Users : <% out.println(++counter); %>   
      </body>
    </html>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: