Create two pages
page1.jsp
<html>
<head><title>Sum of two number</title></head>
<body>
<form method=”post” action=”page2.jsp”>
First NO <input type=”text” name=”no1″ value=””/>
<br/><br/>
Second NO <input type=”text” name=”no2″ value=””/>
<br/><br/>
<input type=”submit” value=”Add” name=”submit” />
<head><title>Sum of two number</title></head>
<body>
<form method=”post” action=”page2.jsp”>
First NO <input type=”text” name=”no1″ value=””/>
<br/><br/>
Second NO <input type=”text” name=”no2″ value=””/>
<br/><br/>
<input type=”submit” value=”Add” name=”submit” />
</form>
</body>
</html>
</body>
</html>
page2.jsp
<html>
<head><title>Sum of two number</title></head>
<body>
<head><title>Sum of two number</title></head>
<body>
Sum of numbser <br>
<%
int x,y;
x=Integer.parseInt(request.getParameter(“no1”));
y=Integer.parseInt(request.getParameter(“no2”));
out.print(x+y);
int x,y;
x=Integer.parseInt(request.getParameter(“no1”));
y=Integer.parseInt(request.getParameter(“no2”));
out.print(x+y);
%>
</body>
</html>
</html>
It is not a big program but you are a beginner and if you have even a small experience with PHP then you can understand it easily.
No comments:
Post a Comment