Simple JSP, Declaration, expression, control structures


<!-- JSP -->

<html>
<body>
<h2><center>

<% out.println("HELLO WORLD"); %>
<br/>

<jsp:scriptlet>
     out.println("HELLO IT");
</jsp:scriptlet>
<br/>

<jsp:declaration>
     int a=2, b=3;
     int c=5;
     int x, f=1;
</jsp:declaration>

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

<br/>
<%= a*a*a %>
<br/>


<%
if (x%2==0)
{
     out.println("EVEN");
}
else
{
     out.println("ODD");
}
%>
<br/>

<%
for( int i=1;i<5;i++)
{
     f = f*i;
}
out.println("factorial = "+f);
%>
<br/>

</center></h2>

</body>
</html>

No comments:

Post a Comment

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

Anu