package oo.encapsulamento.exemplo1.incorreto;

import java.io.IOException;
import java.math.BigDecimal;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class AplicacaoWeb extends HttpServlet {
	private static final long serialVersionUID = 1L;

	private Venda venda;

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		BigDecimal valorTotalVenda = BigDecimal.ZERO;
		for (ItemVenda item : venda.getItens()) {
			valorTotalVenda = valorTotalVenda.add(item.getValor());
		}

		request.setAttribute("valorTotalVenda", valorTotalVenda);

		request.getRequestDispatcher("WEB-INF/venda/resumo.jsp").forward(request, response);
	}

}

@@ -129,32 +129,76 @@
 rvletException;%0A
+import javax.servlet.annotation.WebServlet;%0A
 import javax.ser
@@ -212,32 +212,32 @@
 tp.HttpServlet;%0A
-
 import javax.ser
@@ -314,16 +314,45 @@
 ponse;%0A%0A
+@WebServlet(%22/venda/resumo%22)%0A
 public c
@@ -465,16 +465,26 @@
 venda;%0A%0A
+%09// ...%0A%09%0A
 %09@Overri
@@ -605,16 +605,30 @@
 ption %7B%0A
+%09%09// Trecho 1%0A
 %09%09BigDec
@@ -775,16 +775,30 @@
 );%0A%09%09%7D%0A%0A
+%09%09// Trecho 2%0A
 %09%09reques
@@ -850,16 +850,30 @@
 enda);%0A%0A
+%09%09// Trecho 3%0A
 %09%09reques

Update AplicacaoWeb.java