Simple Calculator using Servlet

Simple Calculator using Servlet

This program shows how you can create simple calculator using Servlet. Here you need to create one home page which will be used take some input from the users like number1, number2 and operator. Once you user fill all required fields and click on submit you need to send their request to Servlet. Here Servlet will process calculate that data based on the operator selected by the users.


You might be lover of java, Am I right ? You can check out few more article written by me using link at the end of article, Don’t forget to subscribe to my blog so you get article by email.


Check out sample code on simple calculator using servlet

<form method=”get” action=”./CalculateServlet”>
Number 1 : <input type=”text” name=”no1″> <br>
Number 2 : <input type=”text” name=”no2″> <br>
Operator :

<select name=”opt”>
<option value=”p”> + </option>
<option value=”m”> – </option>
<option value=”mul”> * </option>
<option value=”d”> / </option>


<input type=”submit” value=”Go”>


Continue Reading….

Check out few more article:

change background color using servlet tutorial

JSP usebean example

More Java Tutorial


Adarsh Patel

My Self Adarsh Suryakant Patel. Currently I am working as Assistant Professor at Parul Instiute of Engineering and Technology, MCA Department, Limda, Vadodara. Major Responsibility : * Lectures * Organizing Training and Expert Sessions for * Placement and Recruitment * Faculty Representative