Simple JSP Program - Declarations and Expressions


<!-- Simple jsp -->

<html>
<head><title>Hello World</title></head>
<body>
            <h2>
           
            <% out.print("HELLO WORLD"); %><br/>  
            <% out.print(2*5); %>  <br/>
            <% out.println("Your IP address is " + request.getRemoteAddr());%><br/>

            <!-- JSP Declarations -->
            <%! int a=2,b=3;int c=5; %>
            <jsp:declaration>
            int x,y;
            </jsp:declaration>

            <!-- JSP Expressions -->
            <%= a*a*a %><br/>

            <jsp:scriptlet>
            x = a*b*c;
            out.println("x = "+x); 
            out.println("y = "+y); 
            </jsp:scriptlet>

            <%= (new java.util.Date()).toLocaleString()%>

            </h2>
</body>
</html>


No comments:

Post a Comment

Don't be a silent reader...
Leave your comments...

Anu