forked from whbogado/servlet-simples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Algumas correções e complemento do XHTML
- Loading branch information
Showing
3 changed files
with
8 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 { | ||
|
||
/** | ||
|
@@ -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>"); | ||
|
@@ -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>"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters