É um servlet de uma calculadora, estou sem ideia do que fazer para funcionar
Eu acho que o problema e no arquivo web.xml mas não tenho certeza absoluta
Não exibe erro no código, esse erro ocorrer quando vai executar
Adicionei o projeto todo no anexo
<html>
<head>
<title>Calculadora</title>
</head>
<body>
<form method= get action="AulaCalc/Calculadora">
Digite N1
<input type= text name ="n1"> <P>
Digite N2
<input type= text name = "n2"> <br>
<input type= Radio name ="Radio" value ="+"> + <br>
<input type= Radio name ="Radio" value ="-"> - <br>
<input type= Radio name ="Radio" value ="*"> * <br>
<input type= Radio name ="Radio" value ="/"> / <br>
<input type= Submit>
</form>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
<display-name>Calculadora</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<display-name>au061010</display-name>
<servlet-name>Calculadora</servlet-name>
<servlet-class>aulaCalc.Calculadora</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Calculadora</servlet-name>
<url-pattern>/Calculadora</url-pattern>
</servlet-mapping>
</web-app>
package aulaCalc;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@SuppressWarnings("serial")
public class Calculadora extends HttpServlet
{
public void doGet(HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
int n1 = Integer.parseInt(req.getParameter("n1"));
int n2 = Integer.parseInt(req.getParameter("n2"));
String operador = req.getParameter("radio");
int result = 0;
if (operador.equals("+"))
result = n1 + n2;
if (operador.equals("-"))
result = n1 - n2;
if (operador.equals("*"))
result = n1 * n2;
if (operador.equals("/"))
result = n1 / n2;
out.println("<HTML>\n" +
"<HEAD><TITLE>Resultado</TITLE></HEAD>\n" +
"<BODY>\n" + n1 + " " +
operador + " " + n2 + " = " + result +
"</BODY></HTML>");
}
}
Exibe a seguinte pagina com essa mensagem:
HTTP Status 404 -
type Status report
message
description The requested resource is not available.
Apache Tomcat/8.0.12
No console do Eclipse isto:
Set 16, 2014 11:14:46 PM org.apache.catalina.startup.Catalina load
INFORMAÇÕES: Initialization processed in 1254 ms
Set 16, 2014 11:14:46 PM org.apache.catalina.core.StandardService startInternal
INFORMAÇÕES: Starting service Catalina
Set 16, 2014 11:14:46 PM org.apache.catalina.core.StandardEngine startInternal
INFORMAÇÕES: Starting Servlet Engine: Apache Tomcat/8.0.12
Set 16, 2014 11:14:47 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFORMAÇÕES: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [260] milliseconds.
Set 16, 2014 11:14:47 PM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler ["http-nio-7080"]
Set 16, 2014 11:14:47 PM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler ["ajp-nio-7009"]
Set 16, 2014 11:14:47 PM org.apache.catalina.startup.Catalina start
INFORMAÇÕES: Server startup in 1394 ms
