web.xml file
<web-app>
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>MyServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/MyServlet</url-pattern>
</servlet-mapping>
</web-app>
MyServlet.java
import java.io.*;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MyServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out=response.getWriter();
response.setContentType("text/html");
int x=Integer.parseInt(request.getParameter("n1"));
int y=Integer.parseInt(request.getParameter("n2"));
out.println("The addition of numbers is "+ (x+y));
}
}
login.html
<h1>Mathematical Functions</h1>
<body>
<form action="MyServlet" method="get">
First number:<INPUT type="number" size="5" name="n1"><br>
Second number:<INPUT type="number" size="5" name="n2">
<br>
<input type="submit" value="Submit">
</form>
</body>
I am getting the folllowing error .
type Status report
message /f/
description The requested resource (/f/) is not available.
f.war is the file i created.
Everything like installing, jdk, apache tomcat is perfect as i have run other programs using the same process. Please help me in solving this error