|
|
| (не показаны 16 промежуточных версий 1 участника) |
| Строка 1: |
Строка 1: |
| − | == Команды и фабрики ==
| + | #REDIRECT [[LXF94:Java EE]] |
| − | ''ЧАСТЬ 6 '''Антон Черноусов''' готов познакомить вас с очередной партией паттернов, которые помогут сделать ваши приложения еще более гибкими и расширяемыми.''
| + | |
| − | | + | |
| − | === Вместо предисловия ===
| + | |
| − | | + | |
| − | | + | |
| − | === Команды ===
| + | |
| − | | + | |
| − | <source lang="java">
| + | |
| − | protected void initCommand(ServletContext sc, HttpServletRequestaRequest,
| + | |
| − | HttpServletResponse aResponse, String viewPath,
| + | |
| − | String resultPath, String errorPath) {
| + | |
| − | this.setSc(sc);
| + | |
| − | this.setARequest(aRequest);
| + | |
| − | this.setAResponse(aResponse);
| + | |
| − | this.setResultPath(resultPath);
| + | |
| − | this.setErrorPath(errorPath);
| + | |
| − | this.setViewPath(viewPath);
| + | |
| − | }
| + | |
| − | public void makeDataToView() {
| + | |
| − | Map<String, String> numbers = new HashMap<String, String>();
| + | |
| − | Map<String, String> comments = new HashMap<String, String>();
| + | |
| − | for (Map.Entry<String, Contact> entry :
| + | |
| − | _addressBook.getContacts().entrySet()) {
| + | |
| − | numbers.put(entry.getKey(), entry.getValue().getNumber());
| + | |
| − | comments.put(entry.getKey(), entry.getValue().getComment());
| + | |
| − | }
| + | |
| − | aRequest.setAttribute(“numbers”, numbers);
| + | |
| − | aRequest.setAttribute(“comments”, comments);
| + | |
| − | if (aRequest.getAttribute(“message”) == null) {
| + | |
| − | aRequest.setAttribute(“message”, “”);
| + | |
| − | }
| + | |
| − | }
| + | |
| − | </source>
| + | |