<html>
<head>
<title>Welcome</title>
</head>
<body>
<center>Welcome</center>
<form action="cadagenda" method="GET">
Nome:
<input type="text" name="nome"><p>
Telefone:
<input type="text" name="telefone"><p>
Sexo:
<input type="radio" name="sexo" value="1">FEMININO
<input type="radio" name="sexo" value="2">MASCULINO<p>
<input type="submit" value="Enviar">
</form>
</body>
</html>
e
*
* Created on 24/05/2010
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package br.com.meuprojeto.servlet;
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;
import javax.servlet.http.HttpSession;
/**
* @author 128249287
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class CadastrarAgenda extends HttpServlet {
protected void doGet(
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
String strNome = request.getParameter("nome");
System.out.println("O nome e:" + strNome);
String strTelefone = request.getParameter("telefone");
System.out.println("O telefone e:" + strTelefone);
String strSexo = request.getParameter("sexo");
HttpSession sessao = request.getSession();
sessao.setAttribute("nome",strNome);
sessao.setAttribute("telefone",strTelefone);
sessao.setAttribute("sexo",strSexo);
response.sendRedirect("resultados.jsp");
}
protected void doPost(
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
//TODO Method stub generated by Lomboz
}
}
