-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLotEditingStrategy.java
More file actions
38 lines (30 loc) · 1.3 KB
/
Copy pathLotEditingStrategy.java
File metadata and controls
38 lines (30 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.example.cw.controllers.Strats;
import com.example.cw.model.Lot;
import com.example.cw.services.LotOfferService;
import com.example.cw.services.LotService;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class LotEditingStrategy extends SomeStrat {
private final LotService lotService;
private final LotOfferService lotOfferService;
public LotEditingStrategy(LotService lotService, LotOfferService lotOfferService) {
this.lotService = lotService;
this.lotOfferService = lotOfferService;
}
@Override
public void execGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
long lotId = Long.parseLong(request.getParameter("lotID"));
Lot lot = lotService.getLotById(lotId);
request.setAttribute("lot", lot);
request.setAttribute("lotOffers", lotOfferService.getOffersForLot(lotId));
request.setAttribute("lotId", lotId);
forwardToJsp(request, response, "LotEditor");
}
@Override
public void execPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
super.execPost(request, response);
}
}