Description:
Servlet technology is used to create web application (resides at server side and generates dynamic web page).
Servlet technology is robust and scalable because of java language. Before Servlet, CGI (Common Gateway Interface) scripting language was popular as a server-side programming language. 
Learn through my videos:

Program:
<html>
<body>
<form action=Add method=get>
Enter 1:<input type="text" name="no1" ><br>
Enter 2:<input type="text" name="no2" ><br>
<input type="submit" value="submit">
</form>
</body>
</html>
import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet(urlPatterns={/Add}) public class Add extends HttpServlet { public void service(HttpServletRequest req, HttpServletResponse res) { int i=Integer.parseInt(req.getParameter(t1)); int j= Integer.parseInt(req.getParameter(t2)); int k=i + j; PrintWriter out =res.getWriter(); out.println(k); } }
Output:


Enter 1:
Enter 2:
10
Logic:
The send the request to client for adding two number server processes his request and sends back the output