Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/ru/javawebinar/basejava/model/Resume.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ public String getFullName() {
return fullName;
}

public void setFullName(String fullName) {
this.fullName = fullName;
}

public Map<ContactType, String> getContacts() {
return contacts;
}
Expand Down
17 changes: 16 additions & 1 deletion src/ru/javawebinar/basejava/web/ResumeServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import javax.servlet.http.*;
import java.io.IOException;
import ru.javawebinar.basejava.Config;
import ru.javawebinar.basejava.model.ContactType;
import ru.javawebinar.basejava.model.Resume;
import ru.javawebinar.basejava.storage.Storage;

Expand Down Expand Up @@ -45,6 +46,20 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

request.setCharacterEncoding("UTF-8");
String uuid = request.getParameter("uuid");
String fullName = request.getParameter("fullName");
Resume resume = storage.get(uuid);
resume.setFullName(fullName);
for (ContactType type : ContactType.values()) {
String value = request.getParameter(type.name());
if (value != null && value.trim().length() != 0) {
resume.addContact(type, value);
} else {
resume.getContacts().remove(type);
}
}
storage.update(resume);
response.sendRedirect("resume");
}
}
37 changes: 34 additions & 3 deletions web/WEB-INF/jsp/edit.jsp
Original file line number Diff line number Diff line change
@@ -1,9 +1,40 @@
<%@ page import="ru.javawebinar.basejava.model.ContactType" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>
<head>
<title>Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="css/style.css">
<jsp:useBean id="resume" type="ru.javawebinar.basejava.model.Resume" scope="request"/>
<title>Resume ${resume.fullName}</title>
</head>
<body>

<jsp:include page="fragments/header.jsp"/>
<section>
<form method="post" action="resume" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="uuid" value="${resume.uuid}">
<dl>
<dt>Name</dt>
<dd><input type="text" name="fullName" size="50" value="${resume.fullName}"></dd>
</dl>
<h3>Contacts</h3>
<c:forEach var="type" items="<%=ContactType.values()%>">
<dl>
<dt>${type.title}</dt>
<dd><input type="text" name="${type.name()}" size="30"
value="${resume.getContact(type)}"></dd>
</dl>
</c:forEach>
<h3>Sections:</h3>
<input type="text" name="section" size="30" value="1"><br/>
<input type="text" name="section" size="30" value="2"><br/>
<input type="text" name="section" size="30" value="3"><br/>
<hr>
<button type="submit">Save</button>
<button onclick="window.history.back()">Cancel</button>
</form>
</section>
<jsp:include page="fragments/footer.jsp"/>
</body>
</html>
</html>
2 changes: 1 addition & 1 deletion web/WEB-INF/jsp/fragments/footer.jsp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%@page contentType="text/html" pageEncoding="UTF-8" %>
<footer>
Project <a href="http://javaops.ru/reg/basejava">Development Web-app ResumeDB</a>
Project <a href="http://javaops.ru/reg/basejava">Web-app development ResumeDB</a>
</footer>
4 changes: 2 additions & 2 deletions web/WEB-INF/jsp/list.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<tr>
<td><a href="resume?uuid=${resume.uuid}&action=view">${resume.fullName}</a></td>
<td><%=ContactType.EMAIL.toHtml(resume.getContact(ContactType.EMAIL))%></td>
<td><a href="resume?uuid=${resume.uuid}&action=delete">Delete</a></td>
<td><a href="resume?uuid=${resume.uuid}&action=edit">Edit</a></td>
<td><a href="resume?uuid=${resume.uuid}&action=delete"><img src="img/delete.png"></a></td>
<td><a href="resume?uuid=${resume.uuid}&action=edit"><img src="img/pencil.png"></a></td>
</tr>
</c:forEach>
</table>
Expand Down
2 changes: 1 addition & 1 deletion web/WEB-INF/jsp/view.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<body>
<jsp:include page="fragments/header.jsp"/>
<section>
<h2>${resume.fullName}&nbsp;<a href="resume?uuid=${resume.uuid}&action=edit">Edit</a></h2>
<h2>${resume.fullName}&nbsp;<a href="resume?uuid=${resume.uuid}&action=edit"><img src="img/pencil.png"></a></h2>
<p>
<c:forEach var="contactEntry" items="${resume.contacts}">
<jsp:useBean id="contactEntry"
Expand Down
52 changes: 51 additions & 1 deletion web/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,54 @@ footer {
font-size: 20px;
padding: 5px 20px;
margin: 20px 0;
}
}

dl {
background: none repeat scroll 0 0 #FAFAFA;
margin: 8px 0;
padding: 0;
}

dt {
display: inline-block;
width: 170px;
}

dd {
display: inline-block;
margin-left: 8px;
vertical-align: top;
}

/*h2, h3 {*/
/* margin: 15px 0 5px;*/
/*}*/

/*li {*/
/* margin: 15px 0;*/
/*}*/

/*a[href^="skype:"] {*/
/* padding-left: 20px !important;*/
/* background: url(../img/skype.png) no-repeat center left;*/
/*}*/

/*a[href^="mailto:"] {*/
/* padding-left: 20px !important;*/
/* background: url(../img/email.png) no-repeat center left;*/
/*}*/

/*a[href^="https://stackoverflow.com"] {*/
/* padding-left: 20px !important;*/
/* background: url(../img/so.png) no-repeat center left;*/
/*}*/

/*a[href^="https://www.linkedin.com"] {*/
/* padding-left: 20px !important;*/
/* background: url(../img/lin.png) no-repeat center left;*/
/*}*/

/*a[href*="github."] {*/
/* padding-left: 20px !important;*/
/* background: url(../img/gh.png) no-repeat center left;*/
/*}*/
Binary file added web/img/add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/img/delete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/img/email.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/img/gh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/img/lin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/img/pencil.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/img/skype.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/img/so.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 3 additions & 8 deletions web/index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/style.css">
<title>Course JavaSE + Web.</title>
<meta http-equiv="refresh" content="0; url=resume"/>
<title></title>
</head>
<body>
<header>Webinars app <a href="http://javawebinar.ru/basejava/" target="_blank">Practise Java.
Development Web-app."</a></header>
<h1>Course JavaSE + Web</h1>
<footer>Webinars app <a href="http://javawebinar.ru/basejava/" target="_blank">Practise Java.
Development Web-app."</a></footer>
<p><a href="resume">Resumes list</a></p>
</body>
</html>