Skip to content

Commit

Permalink
Algumas correções e complemento do XHTML
Browse files Browse the repository at this point in the history
  • Loading branch information
whbogado committed Dec 5, 2012
1 parent aa147d4 commit 6f3e626
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* IF6AE Desenvolvimento de Aplicaçoões Web
* @author Wilson Horstmeyer Bogado <[email protected]>
*/
@WebServlet(name = "Modelo", urlPatterns = {"/modelo"})
@WebServlet(name = "Modelo", urlPatterns = {"/modelo", "/xyz"})
public class Modelo extends HttpServlet {

/**
Expand All @@ -35,6 +35,8 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
out.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" "
+ "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
out.println("<html>");
out.println("<head>");
out.println("<title>Modelo de Servlet</title>");
Expand All @@ -48,9 +50,9 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
String nome = request.getParameter("nome");
if (request.getMethod().equalsIgnoreCase("post")) {
if (nome == null || nome.trim().isEmpty()) {
out.println("<h2 style='color: red'><b>Informe o nome!</b></h2>");
out.println("<h2 style='color: red'>Informe o nome!</h2>");
} else {
out.println("<h2>Olá, <b>" + nome + "</b></h2>");
out.println("<h2>Olá, " + nome + "</h2>");
}
}
out.println("</body>");
Expand Down
5 changes: 2 additions & 3 deletions src/main/webapp/index.jsp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Expand Down

0 comments on commit 6f3e626

Please sign in to comment.