JSP is dynamic programming language. It is capable of making simple program to complex. We can make simple program of add, even numbers, odd numbers. It is good start for beginner to learn with these programs.
First program of adding two numbers in JSP
<%@ page language="java"%> <html> <head> <title>Add number program in JSP</title> </head> <body> <% int a=5; int b=2; int result=a+b; out.print("Additon of a and b :"+result); %> </body> </html>
Second program of subtraction two numbers in JSP
<%@ page language="java"%> <html> <head> <title>Subtraction numbers program in JSP</title> </head> <body> <% int a=5; int b=2; int result=a-b; out.print("Subtraction of a and b :"+result); %> </body> </html>
Third program of print even numbers in JSP
<%@ page language="java"%> <html> <head> <title>Even number program in JSP</title> </head> <body> <% for(int i=0;i<=10;i++) { if((i%2)==0) { out.print("Even number :"+i); out.print("<br>"); } } %> </body> </html>
Forth program of print odd numbers in JSP
<%@ page language="java"%> <html> <head> <title>Odd number program in JSP</title> </head> <body> <% for(int i=0;i<=10;i++) { if((i%2)!=0) { out.print("Odd number :"+i); out.print("<br>"); } } %> </body> </html>
Tags: JSP



Link to Us
well done
plz mail me jsp example program
The actual purpose of jsp is only for presentation, well done but how to separate our presention logic and business logic, for that we can write that in action class, pls mail me with that example
Sir plese send core java and jsp examples with comments to my mail id.for having expertise. i hgave more interest to become java developer. Thank you
it is very good. very usefull to every programer.
sir, this is very nice. but i need much clarification about servlet.
how to complie the jsp
please send all best j2ee examples to my id
good
good exampe for bignner
plz send me the execution process of jsp progrms..
good
hi send me the execution process of jsp.
And how execute manualy.
it’s so good but need much clarification
i need to ejbbeans sample programs