Bom dia pessoal! Estou fazendo um exemplo de uso de Servlet e JSP todo na mão, pra aprender direitinho como as coisas funcionam.
Bom, estou com um problema e nao sei mais o q fazer, deem uma olhada e vejam se conseguem achar algum erro
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="web/NovoServlet" method"GET">
Numero 1 : <input type="text" name="num1"><br>
Numero 2 : <input type="text" name="num1"><br>
<input type="submit">
</form>
</body>
</html>
package web;
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;
public class NovoServlet extends HttpServlet{
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
String n1 = request.getParameter("num1");
String n2= request.getParameter("num2");
Integer int1 = new Integer(n1);
Integer int2= new Integer(n2);
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Novo Servlet</h1>");
out.println(soma(int1.intValue(),int2.intValue()));
out.println("</body>");
out.println("</html>");
out.close();
} finally {
out.close();
}
}
public int soma(int a, int b) {
return a+b;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>NovoServlet</servlet-name>
<servlet-class>web.NovoServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>NovoServlet</servlet-name>
<url-pattern>/web/NovoServlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
<?xml version="1.0"?>
<project name="pack">
<target name="war" description="Empacota o projeto em um arquivo WAR">
<war destfile="ProjetoWeb.war" basedir="../web" webxml="WEB-INF/web.xml" >
<classes dir="../bin">
<include name="**"/>
</classes>
</war>
</target>
</project>
O problema é o seguinte. Eu jogo o WAR criado la na pasta deploy do Jboss, ate aí tudo normal... A pagina inicial roda normalmente, aí qndo eu insiro os numeros e envio, a próxima página fica em branco, sem nenhum código HTML, sem nada mesmo...ja tentei várias coisas, mas nada ta resolvendo...
Alguém sabe o que eu poderia fazer pra resolver o problema?
Um abração
Maracajá
