Интернет-магазин цифровых ключей компьютерных игр

Выбор архитектуры приложения и средств разработки. Проектирование пользовательского интерфейса и базы данных. Реализация серверной и клиентской частей системы. Привязка доменного имени. Настройка инструментов для автоматического развертывания приложения.

Рубрика Программирование, компьютеры и кибернетика
Вид дипломная работа
Язык русский
Дата добавления 14.12.2019
Размер файла 1,7 M

Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже

Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<jsp:include page="/WEB-INF/views/admin/parts/header.jsp"/>

<c:set var="platform" value='${platformDAO.get(urlParam1)}' />

<div class="container">

<div class="row edit-list">

<div class="col-12">

<h2>Редактирование платформы:</h2>

<form method="post">

<input type="hidden" name="id" value="${platform.id}">

<div class="form-group">

<label>Название: </label>

<input type="text" class="form-control" name="name" value="${platform.name}" required>

</div>

<button type="submit" name="platform-edit-submit" class="btn btn-primary">Завершить редактирование</button>

<a class="btn btn-secondary" href="/admin/platform/">Назад</a>

</form>

</div>

</div>

</div>

<jsp:include page="/WEB-INF/views/admin/parts/footer.jsp"/>

Файл: gameshop\src\main\webapp\WEB-INF\views\admin\platform\platform.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<jsp:include page="/WEB-INF/views/admin/parts/header.jsp"/>

<div class="container">

<div class="row edit-list">

<div class="col-12">

<h2>Список всех платформ:</h2>

<table class="table">

<thead class="thead-dark">

<tr>

<th>ID</th>

<th>Название</th>

<th></th>

</tr>

</thead>

<tbody>

<c:set var="platforms" value='${platformDAO.getAll()}' />

<c:forEach items="${platforms}" var="platform">

<tr>

<th scope="row">${platform.id}</th>

<td>${platform.name}</td>

<td class="buttons">

<a class="btn btn-warning" href="/admin/platform/edit/${platform.id}">Редактировать</a>

<form class="remove-form" method="post" action="/admin/platform/remove">

<input type="hidden" name="id" value="${platform.id}">

<button type="submit" name="platform-delete" class="btn btn-danger">Удалить</button>

</form>

</td>

</tr>

</c:forEach>

<c:if test="${empty platforms}">

<tr>

<th colspan="3" scope="row"><% out.print("ПОКА НИЧЕГО НЕ ЗАПОЛНЕНО"); %></th>

</tr>

</c:if>

</tbody>

</table>

</div>

</div>

<div class="row edit-list">

<div class="col-12">

<h2>Добавить платформу:</h2>

<form method="post">

<div class="form-group">

<label>Название: </label>

<input type="text" class="form-control" name="name" required>

</div>

<button type="submit" name="platform-add-submit" class="btn btn-primary">Добавить платформу</button>

</form>

</div>

</div>

</div>

<jsp:include page="/WEB-INF/views/admin/parts/footer.jsp"/>

Файл: gameshop\src\main\webapp\WEB-INF\views\admin\products\import.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<jsp:include page="/WEB-INF/views/admin/parts/header.jsp"/>

<c:set var="games" value='${gameDAO.getAll()}' scope="session" />

<div id="admin-product-import"class="container">

<div class="row edit-list">

<div class="col-12">

<h1>Получить данные с внешнего сервера: </h1>

<form class="external-form" method="post">

<div class="form-group">

<label>Выберите игру, в которую будут импортированы ключи:</label>

<select class="form-control" name="game">

<c:forEach var="game" items="${games}">

<option value="${game.id}">${game.title}</option>

</c:forEach>

</select>

</div>

<div class="form-group">

<label>Ссылка на API поставщика:</label>

<input class="form-control" type="text" name="url" value="https://discoverivan.ru/project/gameshop/?game_id=1&keys_num=10">

</div>

<button type="submit" class="btn btn-warning" name="base-init">Получить</button>

</form>

<div class="alert alert-success" style="display: none"></div>

</div>

</div>

</div>

<jsp:include page="/WEB-INF/views/admin/parts/footer.jsp"/>

Файл: gameshop\src\main\webapp\WEB-INF\views\admin\products\list.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<jsp:include page="/WEB-INF/views/admin/parts/header.jsp"/>

<c:set var="games" value='${gameDAO.getAll()}' scope="session" />

<div id="admin-product-list"class="container">

<div class="row edit-list">

<div class="col-12">

<h1>Список ключей: </h1>

<form class="external-form" method="post">

<div class="form-group">

<label>Выберите игру: </label>

<select class="form-control" name="game">

<c:forEach var="game" items="${games}">

<option value="${game.id}">${game.title}</option>

</c:forEach>

</select>

</div>

<button type="submit" class="btn btn-warning" name="submit">Получить список ключей</button>

</form>

<div class="alert alert-success" style="display: none"></div>

</div>

</div>

</div>

<jsp:include page="/WEB-INF/views/admin/parts/footer.jsp"/>

Файл: gameshop\src\main\webapp\WEB-INF\views\admin\stats\stats.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<jsp:include page="/WEB-INF/views/admin/parts/header.jsp"/>

<section id="admin-stats">

<div class="container">

<div class="row">

<div class="col-12">

<h2>Основная статистика магазина:</h2>

</div>

</div>

<div class="row load" id="load-short-stats">

<div class="col-12">

<img src="/images/admin/loading.svg" width="100">

</div>

</div>

<div id="short-stats-block" class="row" style="display: none;">

<div class="col-md-4">

<div id="all-games" class="stats-block">

<div class="number">0</div>

<p class="label">Всего игр</p>

</div>

</div>

<div class="col-md-4">

<div id="all-orders" class="stats-block">

<div class="number">0</div>

<p class="label">Всего заказов</p>

</div>

</div>

<div class="col-md-4">

<div id="all-customers" class="stats-block">

<div class="number">0</div>

<p class="label">Всего покупателей</p>

</div>

</div>

</div>

<div class="row">

<div class="col-8">

<h2>Подробная статистика:</h2>

</div>

<div class="col-4">

<select id="time-interval" name="time-interval" class="form-control" onchange="changeTimeIntervalOnFullStats()">

<option value="today">сегодня</option>

<option value="7">последние 7 дней</option>

<option value="30">последние 30 дней</option>

<option value="90">последние 90 дней</option>

<option value="180">последние полгода</option>

<option value="all">за все время</option>

</select>

</div>

</div>

<div class="row load" id="load-full-stats">

<div class="col-12">

<img src="/images/admin/loading.svg" width="100">

</div>

</div>

<div class="row" id="full-stats-block" style="display: none;">

<div class="col-md-4">

<div id="orders-count" class="stats-block">

<div class="number">0</div>

<p class="label">заказов</p>

</div>

</div>

<div class="col-md-4">

<div id="orders-sum" class="stats-block">

<div class="number">0</div>

<p class="label">сумма по заказам</p>

</div>

</div>

<div class="col-12">

<canvas id="ordersGraph" height="100"></canvas>

</div>

</div>

</div>

</section>

<jsp:include page="/WEB-INF/views/admin/parts/footer.jsp"/>

Файл: gameshop\src\main\webapp\WEB-INF\views\admin\index.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<jsp:include page="/WEB-INF/views/admin/parts/header.jsp"/>

<section id="admin-index">

<div class="container">

<div class="row">

<div class="col-md-4">

<a href="/admin/game/" class="button-block">

<img src="/images/admin/game.svg">

<p>Игры</p>

</a>

</div>

<div class="col-md-4">

<a href="/admin/order/" class="button-block">

<img src="/images/admin/orders.svg">

<p>Заказы</p>

</a>

</div>

<div class="col-md-4">

<a href="/admin/customer/" class="button-block">

<img src="/images/admin/clients.svg">

<p>Покупатели</p>

</a>

</div>

<div class="col-md-4">

<a href="/admin/stats/" class="button-block">

<img src="/images/admin/stats.svg">

<p>Статистика</p>

</a>

</div>

<div class="col-md-4">

<a href="/admin/settings/" class="button-block">

<img src="/images/admin/settings.svg">

<p>Настройки</p>

</a>

</div>

</div>

</div>

</section>

<jsp:include page="/WEB-INF/views/admin/parts/footer.jsp"/>

Файл: gameshop\src\main\webapp\WEB-INF\views\admin\settings.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<jsp:include page="/WEB-INF/views/admin/parts/header.jsp"/>

<div id="admin-settings"class="container">

<div class="row edit-list">

<div class="col-12">

<h1>Инициализация базы:</h1>

<form method="post">

<button type="submit" class="btn btn-warning" name="base-init">Инициализировать</button>

</form>

</div>

</div>

<div class="row edit-list">

<div class="col-12">

<h1>Нагрузочный тест базы с играми:</h1>

<form method="post">

<div class="form-group">

<label>Количество записей: </label>

<input type="number" min="1" max="100000" class="form-control" name="count" value="1000" required>

</div>

<button type="submit" class="btn btn-warning" name="load-test-base">Заполнить базу</button>

</form>

</div>

</div>

<div class="row edit-list admin-list">

<div class="col-12">

<h2>Список всех администраторов:</h2>

<table class="table">

<thead class="thead-dark">

<tr>

<th>ID</th>

<th>Имя пользователя</th>

<th></th>

</tr>

</thead>

<tbody>

<c:set var="admins" value='${adminDAO.getAll()}' />

<c:forEach items="${admins}" var="admin">

<tr>

<th scope="row">${admin.id}</th>

<td>${admin.username}</td>

<td class="buttons">

<form class="remove-admin" method="post" action="/admin/settings/admin/delete">

<input type="hidden" name="id" value="${admin.id}">

<button type="submit" name="customer-delete" class="btn btn-danger">Удалить</button>

</form>

</td>

</tr>

</c:forEach>

</tbody>

</table>

<div class="alert alert-danger" style="display:none;">Что-то пошло не так...</div>

</div>

</div>

<div class="row edit-list">

<div class="col-12">

<h1>Добавить администратора:</h1>

<form class="add-admin" method="post" action="/admin/settings/admin/add">

<div class="form-group">

<label>Имя пользователя: </label>

<input type="text" class="form-control" name="username" required>

</div>

<div class="form-group">

<label>Пароль: </label>

<input type="password" class="form-control" name="password" required>

</div>

<div class="form-group">

<label>Пароль еще раз: </label>

<input type="password" class="form-control" name="password-confirm" required>

</div>

<button type="submit" class="btn btn-primary">Добавить администратора</button>

</form>

<div class="alert alert-danger" style="display: none;">Что то пошло не так...</div>

<div class="alert alert-success" style="display: none;">Администратор добавлен!</div>

</div>

</div>

</div>

<jsp:include page="/WEB-INF/views/admin/parts/footer.jsp"/>

Файл: gameshop\src\main\webapp\WEB-INF\views\site\account\index.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%@ taglib prefix="security" uri=" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<jsp:include page="/WEB-INF/views/site/parts/header.jsp"/>

<security:authentication var="principal" property="principal" />

<c:set var="user" value="${userService.findByUsername(principal.username)}"/>

<section id="account-index">

<div class="container">

<div class="row">

<div class="col-12">

<h1>Привет, ${user.name}!</h1>

</div>

</div>

<div class="row">

<div class="col-12">

<h3>Список ваших заказов:</h3>

<table class="table table-dark">

<thead>

<tr>

<th scope="col">Дата</th>

<th scope="col">Номер заказа</th>

<th scope="col">Игры в заказе</th>

<th scope="col"></th>

</tr>

</thead>

<tbody>

<c:set var="orders" value='${user.orders}' />

<c:forEach items="${orders}" var="order">

<tr>

<td><fmt:formatDate pattern = "dd.MM.yyyy HH:mm:ss" value = "${order.date}" /></td>

<td>${order.id}</td>

<td>

<c:forEach items="${order.products}" var="product">

${product.game.title}<br>

</c:forEach>

</td>

<td class="buttons">

<a class="main-button" href="/account/order/${order.id}">Подробнее</a>

</td>

</tr>

</c:forEach>

<c:if test="${empty orders}">

<tr>

<th colspan="5" scope="row">ЗАКАЗОВ НЕТ</th>

</tr>

</c:if>

</tbody>

</table>

</div>

</div>

</div>

</section>

<jsp:include page="/WEB-INF/views/site/parts/footer.jsp"/>

Файл: gameshop\src\main\webapp\WEB-INF\views\site\account\order.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<jsp:include page="/WEB-INF/views/site/parts/header.jsp"/>

<security:authentication var="principal" property="principal" />

<c:set var="user" value="${userService.findByUsername(principal.username)}"/>

<c:set var="order" value="${orderDAO.get(urlParam1)}"/>

<c:set var="hasAccess" value="false" />

<c:forEach var="item" items="${user.orders}">

<c:if test="${item.id == order.id}">

<c:set var="hasAccess" value="true" />

</c:if>

</c:forEach>

<c:if test="${empty order || !hasAccess}">

<c:redirect url = "/error404"/>

</c:if>

<section id="account-index">

<div class="container">

<div class="row">

<div class="col-12">

<h1>Заказ №${order.id} (от <fmt:formatDate pattern = "dd.MM.yyyy HH:mm:ss" value = "${order.date}" />)</h1>

<div class="order-details">

<h3>Детали заказа:</h3>

<table>

<c:forEach items="${order.products}" var="product">

<tr>

<td class="image"><img src="${product.game.posterImageUrl}" alt="${product.game.title}"></td>

<td class="title">${product.game.title}</td>

<td class="price">

<fmt:formatNumber type = "number" maxFractionDigits="0" value = "${product.game.price}" /> ?

</td>

</tr>

</c:forEach>

</table>

</div>

<a class="main-button" href="/account">Вернуться назад</a>

</div>

</div>

</div>

</section>

<jsp:include page="/WEB-INF/views/site/parts/footer.jsp"/>

Файл: gameshop\src\main\webapp\WEB-INF\views\site\parts\footer.jsp

<script type='text/javascript' src='/js/jquery.min.js'></script>

<script type='text/javascript' src='/js/jquery.form.min.js'></script>

<script type='text/javascript' src='/js/popper.min.js'></script>

<script type='text/javascript' src='/js/bootstrap.min.js'></script>

<script type='text/javascript' src='/js/main.js'></script>

</body>

</html>

Файл: gameshop\src\main\webapp\WEB-INF\views\site\parts\head-includes.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>

<head>

<meta itemprop="image" content="/images/icon.png" />

<link rel="icon" href="/images/icon.png" sizes="32x32" />

<link rel="icon" href="/images/icon.png" sizes="192x192" />

<link rel="apple-touch-icon-precomposed" href="/images/icon.png" />

<meta name="msapplication-TileImage" content="/images/icon.png" />

<jsp:include page="/WEB-INF/views/site/parts/seo.jsp"/>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width">

<link rel="stylesheet" href="/css/bootstrap.min.css">

<link rel="stylesheet" href="/css/style.css">

</head>

Файл: gameshop\src\main\webapp\WEB-INF\views\site\parts\header.jsp

<%@ page import="ru.discoverivan.gameshop.domain.CartService" %>

<%@ page import="java.io.IOException" %>

<%@ taglib prefix="security" uri=%>

<%@ taglib prefix="gshop" uri="gshop" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<jsp:include page="/WEB-INF/views/site/parts/head-includes.jsp"/>

<body id="index">

<header>

<div class="container">

<div class="row bar">

<div class="col-12">

<a href="/" class="title">GAMESHOP</a>

<div class="links">

<a href="#">Новинки</a>

<a href="#">Популярное</a>

</div>

<div class="right">

<a href="/cart" class="admin">

<div class="name">КОРЗИНА (<gshop:getCartNum cartCookie="${cookie.cart.value}"/>)</div>

<security:authorize access="isAnonymous()">

<a href="/register" class="admin">РЕГИСТРАЦИЯ</a>

<a href="/login" class="admin">ВХОД</a>

</security:authorize>

<security:authorize access="hasAuthority('ADMIN')">

<a href="/admin" class="admin">ПАНЕЛЬ УПРАВЛЕНИЯ</a>

</security:authorize>

<security:authorize access="hasAuthority('CUSTOMER')">

<a href="/account" class="admin">ЛИЧНЫЙ КАБИНЕТ</a>

</security:authorize>

<security:authorize access="isAuthenticated()">

<a href="/logout" class="admin">ВЫЙТИ</a>

</security:authorize>

</div>

</div>

</div>

</div>

</header>

Файл: gameshop\src\main\webapp\WEB-INF\views\site\parts\seo.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<c:choose>

<c:when test="${!empty pageTitle}">

<title>${pageTitle} | GAMESHOP - магазин игр</title>

</c:when>

<c:otherwise>

<title>GAMESHOP - магазин игр</title>

<meta name="description" content="Магазин компьютерных игр" />

</c:otherwise>

</c:choose>

<c:choose>

<c:when test="${!empty pageDescription}">

<meta name="description" content="${pageDescription}" />

</c:when>

<c:otherwise>

<meta name="description" content="Магазин компьютерных игр" />

</c:otherwise>

</c:choose>

Файл: gameshop\src\main\webapp\WEB-INF\views\site\buy-success.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<jsp:include page="/WEB-INF/views/site/parts/header.jsp"/>

<c:if test="${order-success != '1'}">

<%--<c:redirect url = "/"/>--%>

redirect

</c:if>

${order-success}

<section id="order">

<div class="container">

<div class="row">

<div class="col-12">

<h1>Заказ успешно совершен!</h1>

<div class="success">

<p>Проверьте вашу почту. На нее должен прийти ключ продукта.</p>

<a class="main-button" href="/">Вернуться к покупкам</a>

</div>

</div>

</div>

</div>

</section>

<jsp:include page="/WEB-INF/views/site/parts/footer.jsp"/>

Файл: gameshop\src\main\webapp\WEB-INF\views\site\cart.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<jsp:include page="/WEB-INF/views/site/parts/header.jsp"/>

<section id="order">

<div class="container">

<div class="row">

<div class="col-12">

<h1>Корзина:</h1>

<table>

<c:choose>

<c:when test="${fn:length(cart)>0}">

<c:set var="total" value="${0}"/>

<c:forEach items="${cart}" var="gameId" >

<c:set var="game" value='${gameDAO.get(gameId)}' />

<c:set var="total" value="${total-price + game.price}"/>

<tr>

<td class="image"><img src="${game.posterImageUrl}" alt="${game.title}"></td>

<td class="title">${game.title}</td>

<td class="price">

<fmt:formatNumber type = "number" maxFractionDigits="0" value = "${game.price}" /> ?

</td>

<td class="delete">

<form method="post">

<input type="hidden" name="game-id" value="${gameId}">

<button type="submit" class="main-button">Удалить</button>

</form>

</td>

</tr>

</c:forEach>

</c:when>

<c:otherwise>

<tr>

<th colspan="4" scope="row">ТОВАРОВ В КОРЗИНЕ НЕТ</th>

</tr>

</c:otherwise>

</c:choose>

</table>

<c:choose>

<c:when test="${fn:length(cart)>0}">

<div class="order-footer row">

<div class="col-md-6 back">

<a href="/">Вернуться к покупкам</a>

</div>

<div class="col-md-6 total">

<div class="label">Итого к оплате: </div>

<div class="price">

<fmt:formatNumber type = "number" maxFractionDigits="0" value = "${total}" /> ?

</div>

</div>

</div>

<div class="input-block">

<form action="/buy" method="post">

<button class="main-button" type="submit" name="order-submit">ПЕРЕЙТИ К ОПЛАТЕ</button>

</form>

</div>

</c:when>

<c:otherwise>

<div class="row buy-something">

<div class="col-12">

<a href="/" class="main-button">Парейти на главную страницу</a>

</div>

</div>

</c:otherwise>

</c:choose>

</div>

</div>

</div>

</section>

<jsp:include page="/WEB-INF/views/site/parts/footer.jsp"/>

Файл: gameshop\src\main\webapp\WEB-INF\views\site\error.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<jsp:include page="/WEB-INF/views/site/parts/head-includes.jsp"/>

<body id="index">

<section id="error">

<div class="container">

<div class="row">

<div class="col-12 wrapper">

<div class="error-block">

<img src="/images/icon.png">

<div class="code">${statusCode}</div>

<div class="description">

<c:choose>

<c:when test="${statusCode == 404}">

Запрашиваемая страница не найдена

</c:when>

<c:when test="${statusCode == 403}">

У вас нет доступа

</c:when>

<c:when test="${statusCode == 500}">

Внутренняя ошибка сервера

</c:when>

<c:otherwise>

Неизвестная ошибка

</c:otherwise>

</c:choose>

</div>

<div class="back">

<a class="main-button" href="/">Перейти на главную страницу</a>

</div>

</div>

</div>

</div>

</div>

</section>

<jsp:include page="/WEB-INF/views/site/parts/footer.jsp"/>

Файл: gameshop\src\main\webapp\WEB-INF\views\site\game-full.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<c:set var="game" value='${gameDAO.get(urlParam1)}' scope="request" />

<c:set var="pageTitle" value="${game.title}" scope="request"/>

<c:set var="pageDescription" value="${game.description}" scope="request"/>

<jsp:include page="/WEB-INF/views/site/parts/header.jsp"/>

<c:if test="${empty game}">

<c:redirect url = "/error404"/>

</c:if>

${shopService.gameViewed(game.id)}

<section id="game-full">

<div class="container">

<div class="row">

<div class="col-lg-4">

<div class="poster">

<img src="${game.posterImageUrl}" alt="${game.title}">

</div>

<div class="price">

<fmt:formatNumber type = "number" maxFractionDigits="0" value = "${game.price}" /> ?

</div>

<c:choose>

<c:when test="${fn:contains(cart, game.id)}">

<a href="/cart" class="buy main-button main-button-block">Перейти в корзину</a>

</c:when>

<c:otherwise>

<form method="post" class="buy-button">

<button type="submit" class="buy main-button main-button-block">Купить сейчас</button>

</form>

</c:otherwise>

</c:choose>

</div>

<div class="col-lg-8">

<div class="game-info">

<h1 class="game-title">${game.title}</h1>

<table class="tech-info">

<tr>

<td class="name">Платформа:</td>

<td class="value">

<c:forEach items="${game.platforms}" var="platform">

<span class="badge badge-pill badge-secondary">${platform.name}</span>

</c:forEach>

</td>

</tr>

<tr>

<td class="name">Разработчик:</td>

<td class="value">${game.developer}</td>

</tr>

<tr>

<td class="name">Дата выхода:</td>

<td class="value">

<fmt:formatDate pattern = "dd.MM.yyyy" value = "${game.releaseDate}" />

</td>

</tr>

<tr>

<td class="name">Просмотров:</td>

<td class="value">

${game.views}

</td>

</tr>

<tr>

<td class="name">Жанр:</td>

<td class="value">

<c:forEach items="${game.genres}" var="genre">

<span class="badge badge-pill badge-secondary">${genre.name}</span>

</c:forEach>

</td>

</tr>

<tr>

<td class="name">Язык:</td>

<td class="value">

<c:forEach items="${game.languages}" var="language">

<span class="badge badge-pill badge-secondary">${language.name}</span>

</c:forEach>

</td>

</tr>

</table>

<h2>Описание:</h2>

<p class="game-description">${game.description}</p>

<c:if test="${!empty game.screenshotsUrls}">

<h2>Скриншоты:</h2>

<div class="row screenshots">

<c:forEach items="${game.screenshotsUrls}" var="screenshot">

<div class="col-lg-6">

<img src="${screenshot}" alt="${game.title}">

</div>

</c:forEach>

</c:if>

</div>

</div>

</div>

</div>

</div>

</section>

<jsp:include page="/WEB-INF/views/site/parts/footer.jsp"/>

Файл: gameshop\src\main\webapp\WEB-INF\views\site\index.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%@ taglib prefix="security" uri= %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<jsp:include page="/WEB-INF/views/site/parts/header.jsp"/>

<ection class="banners">

<div class="container">

<div class="row">

<div class="col-12">

<div id="banners-slider" class="carousel slide" data-ride="carousel">

<div class="carousel-inner">

<div class="carousel-item active">

<a href="#" class="banner" style="background-image: url">

<div class="label-wrap">

<div class="label primary">Tomb Raider</div>

<div class="label secondary">Купить сейчас</div>

</div>

</a>

</div>

<div class="carousel-item">

<a href="#" class="banner" style="background-image: url">

<div class="label-wrap">

<div class="label primary">Far Cry 5</div>

<div class="label secondary">Купить сейчас</div>

</div>

</a>

</div>

</div>

</div>

</div>

</div>

</div>

</section>

<section class="games-list">

<div class="container">

<div class="row">

<div class="col-12">

<a href="#" class="category-title">Новинки</a>

</div>

</div>

<div class="row cards">

<c:forEach items="${gameDAO.getOrderedList('release_date', 4)}" var="game">

<div class="col-lg-3">

<div class="game-card" style="background-image: url('${game.posterImageUrl}')">

<div class="title">${game.title}</div>

<div class="bottom">

<div class="price">

<fmt:formatNumber type = "number" maxFractionDigits="0" value = "${game.price}" /> ?

</div>

<a href="game/${game.id}" class="main-button">КУПИТЬ</a>

</div>

</div>

</div>

</c:forEach>

</div>

<div class="row">

<div class="col-12">

<a href="#" class="category-title">Самые популярные</a>

</div>

</div>

<div class="row cards">

<c:forEach items="${gameDAO.getOrderedList('views', 4)}" var="game">

<div class="col-lg-3">

<div class="game-card" style="background-image: url('${game.posterImageUrl}')">

<div class="title">${game.title}</div>

<div class="bottom">

<div class="price">

<fmt:formatNumber type = "number" maxFractionDigits="0" value = "${game.price}" /> ?

</div>

<a href="game/${game.id}" class="main-button">КУПИТЬ</a>

</div>

</div>

</div>

</c:forEach>

</div>

</div>

</section>

<jsp:include page="/WEB-INF/views/site/parts/footer.jsp"/>

Файл: gameshop\src\main\webapp\WEB-INF\views\site\login.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%@ taglib prefix="security" uri= %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<c:set var="pageTitle" value="Авторизация" scope="request"/>

<c:set var="pageDescription" value="Вход на сайт" scope="request"/>

<jsp:include page="/WEB-INF/views/site/parts/head-includes.jsp"/>

<security:authorize access="isAuthenticated()">

<% response.sendRedirect("/"); %>

</security:authorize>

<body id="login">

<form id="login-form" class="form-signin" method="post" action="/login">

<a href="/"><img class="icon" src="/images/icon.png" alt="" width="100" height="100"></a>

<h1>Авторизация</h1>

<input type="text" name="username" class="form-control" placeholder="Имя пользователя" required autofocus>

<input type="password" name="password" class="form-control" placeholder="Пароль" required>

<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>

<button class="main-button main-button-block" type="submit">Войти</button>

<c:choose>

<c:when test="${param.error == 1}">

<div class="alert alert-danger" role="alert">

Неправильный логин или пароль

</div>

</c:when>

<c:when test="${param.logout == 1}">

<div class="alert alert-primary" role="alert">

Вы успешно вышли из системы

</div>

</c:when>

</c:choose>

<a class="back" href="/register">Зарегистрироваться</a>

</form>

<jsp:include page="/WEB-INF/views/site/parts/footer.jsp"/>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<c:set var="pageTitle" value="Авторизация" scope="request"/>

<c:set var="pageDescription" value="Вход на сайт" scope="request"/>

<jsp:include page="/WEB-INF/views/site/parts/head-includes.jsp"/>

<security:authorize access="isAuthenticated()">

<% response.sendRedirect("/"); %>

</security:authorize>

<body id="register">

<form:form id="login-form" class="form-signin register-form" method="post" modelAttribute="registerForm">

<a href="/"><img class="icon" src="/images/icon.png" alt="" width="100" height="100"></a>

<h1>Регистрация покупателя</h1>

<form:input type="text" path="name" name="name"

class="form-control" placeholder="Ваше имя" required="required" autofocus="autofocus"

data-toggle="tooltip" data-placement="right" data-trigger="manual"/>

<form:input type="email" name="email" path="email"

class="form-control" placeholder="Электронная почта" required="required"

data-toggle="tooltip" data-placement="right" data-trigger="manual"/>

<form:input type="text" name="username" path="username"

class="form-control" placeholder="Имя пользователя" required="required"

data-toggle="tooltip" data-placement="right" data-trigger="manual"/>

<form:input type="password" name="password" path="password"

class="form-control" placeholder="Пароль" required="required"

data-toggle="tooltip" data-placement="right" data-trigger="manual"/>

<form:input type="password" name="passwordConfirm" path="passwordConfirm"

class="form-control" placeholder="Подтверждение пароля" required="required"

data-toggle="tooltip" data-placement="right" data-trigger="manual"/>

<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>

<button class="main-button main-button-block" type="submit">Создать аккаунт</button>

<div class="alert alert-danger" role="alert" style="display: none;">

Что-то пошло не так...

</div>

<a class="back" href="/login">Уже зарегистрированы?</a>

</form:form>

<jsp:include page="/WEB-INF/views/site/parts/footer.jsp"/>

<http auto-config="true">

<intercept-url pattern="/admin/**" access="hasAuthority('ADMIN')"/>

<intercept-url pattern="/account/**" access="hasAuthority('CUSTOMER')"/>

<intercept-url pattern="/buy/**" access="hasAuthority('CUSTOMER')"/>

<form-login login-page="/login" authentication-failure-url="/login?error=1"

username-parameter="username" password-parameter="password"/>

<logout logout-success-url="/login?logout=1"/>

<csrf disabled="true"/>

<authentication-manager alias="authenticationManager">

<authentication-provider user-service-ref="userDetailsService">

<password-encoder ref="encoder"/>

</authentication-provider>

</authentication-manager>

<beans:bean id="userDetailsService" class="ru.discoverivan.gameshop.domain.UserDetailsService"/>

<beans:bean id="encoder"

class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder">

<beans:constructor-arg name="strength" value="11"/>

</beans:bean>

</beans:beans>

<import resource="application-security.xml"/>

<context:component-scan base-package = "ru.discoverivan.gameshop.controller" />

<context:component-scan base-package = "ru.discoverivan.gameshop.domain" />

<context:component-scan base-package = "ru.discoverivan.gameshop.db.dao" />

<context:component-scan base-package = "ru.discoverivan.gameshop.validation" />

<mvc:annotation-driven/>

<mvc:resources mapping="/css/**" location="/css/" />

<mvc:resources mapping="/images/**" location="/images/" />

<mvc:resources mapping="/js/**" location="/js/" />

<bean class = "org.springframework.web.servlet.view.InternalResourceViewResolver">

<property name = "prefix" value = "/WEB-INF/views/" />

<property name = "suffix" value = ".jsp" />

<bean>

<bean id="appLoader" class="ru.discoverivan.gameshop.AppLoader" destroy-method="close"/>

<bean id="debug" class="ru.discoverivan.gameshop.Debug" autowire="byType"/>

</beans>

Файл: gameshop\src\main\webapp\WEB-INF\gameshopTags.tld

<?xml version="1.0" encoding="UTF-8" ?>

version="2.0">

<description>Gameshop Tag Library</description>

<tlib-version>1.0</tlib-version>

<short-name>gshop</short-name>

<tag>

<name>getCartNum</name>

<tag-class>ru.discoverivan.gameshop.tags.GetCartNumTag</tag-class>

<body-content>empty</body-content>

<attribute>

<name>cartCookie</name>

<required>true</required>

<rtexprvalue>true</rtexprvalue>

</attribute>

</tag>

</taglib>

<display-name>Gameshop</display-name>

<servlet>

<servlet-name>dispatcherServlet</servlet-name>

<servlet-class>

org.springframework.web.servlet.DispatcherServlet

</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>dispatcherServlet</servlet-name>

<url-pattern>/</url-pattern>

</servlet-mapping>

<servlet>

<servlet-name>ErrorHandler</servlet-name>

<servlet-class>ru.discoverivan.gameshop.servelets.ErrorHandler</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>ErrorHandler</servlet-name>

<url-pattern>/error</url-pattern>

</servlet-mapping>

<error-page>

<location>/error</location>

</error-page>

<error-page>

<error-code>405</error-code>

<location>/error</location>

</error-page>

<error-page>

<exception-type>java.lang.Throwable</exception-type>

<location>/error</location>

</error-page>

<filter>

<filter-name>CharacterEncodingFilter</filter-name>

<filter-class>ru.discoverivan.gameshop.filters.CharacterEncodingFilter</filter-class>

<init-param>

<param-name>encoding</param-name>

<param-value>UTF-8</param-value>

</init-param>

</filter>

<filter-mapping>

<filter-name>CharacterEncodingFilter</filter-name>

<servlet-name>dispatcherServlet</servlet-name>

</filter-mapping>

<filter>

<filter-name>springSecurityFilterChain</filter-name>

<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>

</filter>

<filter-mapping>

<filter-name>springSecurityFilterChain</filter-name>

<url-pattern>/*</url-pattern>

</filter-mapping>

<jsp-config>

<taglib>

<taglib-uri>gshop</taglib-uri>

<taglib-location>/WEB-INF/gameshopTags.tld</taglib-location>

</taglib>

</jsp-config>

</web-app>

<groupId>ru.discoverivan.gameshop</groupId>

<artifactId>gameshop</artifactId>

<version>1.0-SNAPSHOT</version>

<packaging>war</packaging>

<properties>

<smtp.host>smtp.yandex.com</smtp.host>

<smtp.user>gameshop@discoverivan.ru</smtp.user>

<smtp.password>*****</smtp.password>

<springVersion>5.0.7.RELEASE</springVersion>

</properties>

<dependencies>

<dependency>

<groupId>org.junit.jupiter</groupId>

<artifactId>junit-jupiter-api</artifactId>

<version>RELEASE</version>

<scope>test</scope>

</dependency>

<dependency>

<groupId>javax.servlet</groupId>

<artifactId>javax.servlet-api</artifactId>

<version>4.0.0</version>

<scope>provided</scope>

</dependency>

<dependency>

<groupId>javax.servlet</groupId>

<artifactId>jstl</artifactId>

<version>1.2</version>

</dependency>

<dependency>

<groupId>javax</groupId>

<artifactId>javaee-api</artifactId>

<version>7.0</version>

<scope>provided</scope>

</dependency>

<dependency>

<groupId>javax</groupId>

<artifactId>javaee-web-api</artifactId>

<version>6.0</version>

<scope>provided</scope>

</dependency>

<dependency>

<groupId>com.h2database</groupId>

<artifactId>h2</artifactId>

<version>1.4.197</version>

</dependency>

<dependency>

<groupId>mysql</groupId>

<artifactId>mysql-connector-java</artifactId>

<version>5.1.6</version>

</dependency>

<dependency>

<groupId>org.hibernate</groupId>

<artifactId>hibernate-core</artifactId>

<version>5.3.4.Final</version>

</dependency>

<dependency>

<groupId>javax.xml.bind</groupId>

<artifactId>jaxb-api</artifactId>

<version>2.3.0</version>

</dependency>

<dependency>

<groupId>com.sun.xml.bind</groupId>

<artifactId>jaxb-impl</artifactId>

<version>2.2.11</version>

</dependency>

<dependency>

<groupId>com.sun.xml.bind</groupId>

<artifactId>jaxb-core</artifactId>

<version>2.2.11</version>

</dependency>

<dependency>

<groupId>javax.mail</groupId>

<artifactId>mail</artifactId>

<version>1.4</version>

</dependency>

<dependency>

<groupId>org.springframework</groupId>

<artifactId>spring-context</artifactId>

<version>${springVersion}</version>

</dependency>

<dependency>

<groupId>org.springframework</groupId>

<artifactId>spring-webmvc</artifactId>

<version>${springVersion}</version>

</dependency>

<dependency>

<groupId>org.springframework.security</groupId>

<artifactId>spring-security-core</artifactId>

<version>${springVersion}</version>

</dependency>

<dependency>

<groupId>org.springframework.security</groupId>

<artifactId>spring-security-config</artifactId>

<version>${springVersion}</version>

</dependency>

<dependency>

<groupId>org.springframework.security</groupId>

<artifactId>spring-security-web</artifactId>

<version>${springVersion}</version>

</dependency>

<dependency>

<groupId>org.springframework.security</groupId>

<artifactId>spring-security-taglibs</artifactId>

<version>${springVersion}</version>

</dependency>

<dependency>

<groupId>com.fasterxml.jackson.core</groupId>

<artifactId>jackson-databind</artifactId>

<version>2.9.6</version>

</dependency>

</dependencies>

<build>

<plugins>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-compiler-plugin</artifactId>

<configuration>

<source>1.8</source>

<target>1.8</target>

</configuration>

</plugin>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-war-plugin</artifactId>

<version>2.1.1</version>

<configuration>

<failOnMissingWebXml>false</failOnMissingWebXml>

</configuration>

</plugin>

<plugin>

<groupId>org.apache.tomcat.maven</groupId>

<artifactId>tomcat7-maven-plugin</artifactId>

<version>2.2</version>

<configuration>

<server>TomcatServer</server>

<username>admin</username>

<password>******</password>

<path>/</path>

<update>true</update>

<systemProperties>

<smtp.host>${smtp.host}</smtp.host>

<smtp.user>${smtp.user}</smtp.user>

<smtp.password>${smtp.password}</smtp.password>

</systemProperties>

</configuration>

</plugin>

</plugins>

</build>

</project>

Размещено на Allbest.ru

...

Подобные документы

Работы в архивах красиво оформлены согласно требованиям ВУЗов и содержат рисунки, диаграммы, формулы и т.д.
PPT, PPTX и PDF-файлы представлены только в архивах.
Рекомендуем скачать работу.