Questão
ID 2570599Disciplina: Tecnologia da Informação
Assunto: Servlets
Ano: 2013 Banca: FGV - Fundação Getúlio Vargas Órgão: Assembleia Legislativa do Estado de Mato Grosso
Considere a página HTML A.html, o servlet B e a página JSP I.jsp mostrados a seguir:
Arquivo A.html |
<html> <body> <form action="B" method="post"> <input type="hidden" name="c" value="d"/> <input type="submit"/> </form> </body> </html> |
Servlet B |
package e; import java.io.IOException; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public class B extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServletContext application = getServletContext(); HttpSession session = request.getSession(); application.setAttribute("c", "f"); session.setAttribute("c", "g"); PageContext pageContext = JspFactory.getDefaultFactory(). getPageContext(this, request, response, null, true, 8192, true); pageContext.setAttribute("c", "h"); request.setAttribute("c", "j"); request.getRequestDispatcher("I.jsp"). forward(request, response); } } |
Arquivo I.jsp |
<%@ page language="java" contentType="text/html"%> <html> <body> \${c } </body> </html> |
Considere que todos os links entre os itens listados anteriormente estão corretos. A página JSPO exibirá