Розробка веб-системи продажі білетів театру

Автор работы: Пользователь скрыл имя, 31 Мая 2013 в 01:06, курсовая работа

Описание

Метою даного курсового проекту є розробка програми, що надає собою доступ до покупки квитків театру в інтернеті. Додаток заснований на технології Java EE і активно використовує його можливості по створенню розподілених інформаційних систем

Содержание

ПЕРЕЧЕНЬ УСЛОВНЫХ ОБОЗНАЧЕНИЙ, СИМВОЛОВ, ЕДИНИЦ, СОКРАЩЕНИЙ И ТЕРМИНОВ 8
ВВЕДЕНИЕ 9
1 АНАЛИЗ РАБОТЫ 11
1.1 Ключевые понятия 11
1.2 Описание работы 12
2 ТЕХНИЧЕСКАЯ РЕАЛИЗАЦИЯ 13
2.1 Выбор технологии реализации 13
2.1 Анализ работы с сервлетами и JSP-страницами 14
3 СТРУКТУРА ПРИЛОЖЕНИЯ 15
3.1 Структура базы данных 15
3.2 Разработа структуры взаимодействия компонентов программы 15
3.3 Разработка сервлета действия 17
3.4 Разработка внешнего вида приложения 19
4 ИНТЕРФЕЙС И РАБОТА ПРОГРАММЫ 20
5 ТЕСТИРОВАНИЕ 18
5.1 Технические требования 18
5.1 Тестирование программы 18
ВЫВОДЫ 20
ПЕРЕЧЕНЬ ССЫЛОК 21
ПРИЛОЖЕНИЕ А 23

Работа состоит из  1 файл

ККП Даниленков Д.О. КИ-08-2.doc

— 844.50 Кб (Скачать документ)

                </div>

            </div>

            <div class="clear">&nbsp;</div>

        </div>

        <div id="right-column">

         <br />

         <center><img src="images/logo.png" /></center>

            <br /> <br />

         <h3>About us</h3>

            <p>Theater.</p>

            <p>Working on.</p>

            <br /> <br />

 

         <h3>Navigation</h3>

            <a href="index.html" class="nav-link">Main</a>

<a href="ticket.jsp" class="nav-link">Book a ticket</a>

            <a href="contact.jsp" class="nav-link">Contact us</a>

            <br /> <br />

            <form name="serach_form" action="#" method="get">

                <h3>Search</h3>

                <input type="text" class="input" name="search" />

            </form>

            <br /> <br />

            <h3>The best</h3>

            <a href="#" class="nav-link">Captains of sand</a>

<a href="#" class="nav-link">Dyadya Vanya</a>

            <a href="#" class="nav-link">Viy</a>

        </div>

        <div class="clear">&nbsp;</div>

        <div id="footer">

         &copy; Copyright 2012.

        </div>

    </div>

</body>

</html>

 

Листинг ListFile.jsp

 

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"

    pageEncoding="ISO-8859-1"%>

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

<%@ page import = "com.profitsoft.model.*" %>

<%@ page import = "com.profitsoft.daoimpl.*" %>

<%@ page import = "com.profitsoft.DAO.*" %>

<%@ page import = "com.profitsoft.services.*" %>

<%@ page import = "java.util.*" %>

<%@ page import = "org.springframework.context.support.ClassPathXmlApplicationContext" %>

<%

 

ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext ("com/profitsoft/daoimpl/DBConf.xml");

PlayService plService = (PlayService) ctx.getBean("playService");

 

List<Play> playList = plService.getPlays();

%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>Insert title here</title>

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

</head>

<body>

<div id="header-line">&nbsp;</div>

    <div id="wraper">

     <div id="left-column">

         <H3>The list of plays</H3>

         <%

          for (Play plays : playList) {

           out.println ("Play name:" + plays.getName());

           out.println ("Play author:" + plays.getAuthor());

           out.println ("Play genre:" + plays.getGenre());

           out.println(" <hr> ");

            }

         %>

        </div>

        <div id="right-column">

         <br />

         <center><img src="images/logo.png" /></center>

          

            <h3>Navigation</h3>

            <a href="index.html" class="nav-link">Main</a>

<a href="ticket.jsp" class="nav-link">Book a ticket</a>

            <a href="contact.jsp" class="nav-link">Contact us</a>

            <br /> <br />

                       <br /> <br />

                   </div>

        <div class="clear">&nbsp;</div>

        <div id="footer">

         &copy; Copyright 2012.

        </div>

    </div>

</body>

</html>

 

Листинг single.jsp

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />

<title>Time 2 show</title>

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

    <script src="js/jquery-1.7.1.min.js"></script>

       

</head>

 

<body>

<div id="header-line">&nbsp;</div>

    <div id="wraper">

     <div id="left-column">

         <div class="play">

                <div class="time">

                    Small Scene<br />

                    Theater 19<br />

                    11 Jan 2012

                </div>

                <div class="description">

                    <img src="images/promodv01.jpg" />

                    <h2>"Dyadya Vanya"</h2>

                    <p>Description 1</p>

                    <br />

                    <p>Description 2…</p>

                    <br />

                    <p>Some author</p>

                    <br />

<p>Director</p>

                    <br />

                    <p>Arts</p>

                    <br />

                    <p>Music</p>

                </div>

            </div>

            <div class="clear">&nbsp;</div>

        </div>

        <div id="right-column">

         <br />

         <center><img src="images/logo.png" /></center>

            <br /> <br />

         <h3>About us</h3>

            <p>Our Theater.</p>

            <p>Yeah, description</p>

            <br /> <br />

 

             <h3>Navigation</h3>

            <a href="index.html" class="nav-link">Main</a>

<a href="ticket.jsp" class="nav-link">Book a ticket</a>

            <a href="contact.jsp" class="nav-link">Contact us</a>

            <br /> <br />

            <form name="serach_form" action="#" method="get">

                <h3>Search</h3>

                <input type="text" class="input" name="search" />

            </form>

            <br /> <br />

            <h3>The best</h3>

            <a href="#" class="nav-link">Captains of sand</a>

<a href="#" class="nav-link">Dyadya Vanya</a>

            <a href="#" class="nav-link">Viy</a>

        </div>

        <div class="clear">&nbsp;</div>

        <div id="footer">

         &copy; Copyright 2012.

        </div>

    </div>

</body>

</html>

 

Листинг ticket.jsp

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />

<title>Time 2 show</title>

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

    <script src="js/jquery-1.7.1.min.js"></script>

    <script src="js/script.js"></script>

       

</head>

 

<body>

<div id="header-line">&nbsp;</div>

    <div id="wraper">

     <div id="left-column">

         <div class="play">

                <div class="time">

                    Book a ticket

                </div>

                <div class="description">

                 <form action="#" method="post">

                     <span class="input-title">Name</span>

                     <input type="text" class="input" name="name" />

                     <span class="input-title">e-mail</span>

                        <input type="text" class="input" name="email"/>

                     <span class="input-title">Choose your play</span>

                        <select class="select" name="play">

                         <option disabled="disabled">Choose name</option>

                            <option class="1" value="1">Dyadya Vanya</option>

                            <option value="2">Viy</option>

                            <option value="3">Captains of sand</option>

                        </select>

                        <div class="first">

                         Sorry, all of the tickets are sold

                        </div>

                        <div class="second">

                         Only through checkout

                        </div>

                        <div class="third">

                            <span class="input-title">Number of tickets</span>

                            <input type="text" class="input" name="count" />

                            <input type="submit" value="Book"/>

                        </div>

                    </form>

                </div>

            </div>

            <div class="clear">&nbsp;</div>

        </div>

          <div id="right-column">

         <br />

         <center><img src="images/logo.png" /></center>

            <br /> <br />

         <h3>About us</h3>

            <p>Our theater.</p>

            <p>Working on.</p>

            <hr></hr>

            <br /> <br />

            <h3>Get lists</h3>

            <a href="ListFile.jsp">Get all plays available</a>

            <form action = "http://localhost:8888/Theatre/DownloadDemo">

            <input type = "submit" value = "download list"/>

            </form>

    <br /> <br />

    <hr></hr>

            <h3>Navigation</h3>

            <a href="index.html" class="nav-link">Main</a>

<a href="ticket.jsp" class="nav-link">Book a ticket</a>

            <a href="contact.jsp" class="nav-link">Contact us</a>

            <hr></hr>

            <br /> <br />

            <form name="serach_form" action="#" method="get">

                <h3>Search</h3>

                <input type="text" class="input" name="search" />

            </form>

            <hr></hr>

            <br /> <br />

            <h3>The best</h3>

            <a href="#" class="nav-link">Captains of sand</a>

<a href="#" class="nav-link">Dyadya Vanya</a>

            <a href="#" class="nav-link">Viy</a>

        </div>

        <div class="clear">&nbsp;</div>

        <div id="footer">

         &copy; Copyright 2012.

        </div>

    </div>

</body>

</html>

 

Листинг PlayDAO.java

 

package com.profitsoft.DAO;

 

 

import java.util.List;

 

import com.profitsoft.model.Play;

 

public interface PlayDAO {

 

public void insertPlay (Play play);

public void deletePlay (Play play);

public void updatePlay (Play play);

public Play findPlay (int id);

public List<Play> getPlays();

 

}

 

Листинг SeasonDAO.java

 

package com.profitsoft.DAO;

 

import com.profitsoft.model.Season;

 

public interface SeasonDAO {

public void insertSeason (Season season);

public void deleteSeason (Season season);

public void updateSeason (Season season, int id);

public Season findSeason (int id);

}

 

Листинг ShowDAO.java

 

package com.profitsoft.DAO;

 

import com.profitsoft.model.Show;

 

public interface ShowDAO {

public void insertShow (Show show);

public void deleteShow (Show show);

public void updateShow (Show show, int id);

public Show findShow (int id);

}

 

Листинг PlayDAOImpl.java

 

package com.profitsoft.daoimpl;

 

import java.util.ArrayList;

import java.util.List;

 

import org.apache.log4j.Logger;

import org.hibernate.Query;

import org.hibernate.Session;

import org.hibernate.SessionFactory;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.orm.hibernate3.HibernateTemplate;

import org.springframework.stereotype.Repository;

import org.springframework.transaction.annotation.Transactional;

 

import com.profitsoft.DAO.*;

import com.profitsoft.model.Play;

 

 

@Transactional

@Repository

public class PlayDAOImpl implements PlayDAO {

private static final Logger log = Logger.getLogger(PlayDAOImpl.class);

 

// private HibernateTemplate hibernateTemplate;

private HibernateTemplate hibernateTemplate;

private static final String SQL_SELECT_ALL = "SELECT * FROM plays";

 

public void setHibernateTemplate(SessionFactory sessionFactory){

this.hibernateTemplate = new HibernateTemplate(sessionFactory);

}

 

@Override

public void insertPlay(Play play) {

hibernateTemplate.save(play);

log.warn("Play inserted");

}

 

@Override

public void deletePlay(Play play) {

hibernateTemplate.delete(play);

log.warn("Play deleted");

}

 

@Override

public void updatePlay(Play play) {

hibernateTemplate.update(play);

log.warn("Play inserted");

}

 

@Override

public Play findPlay(int id) {

log.warn("Object found");

return (Play)hibernateTemplate.get(Play.class, id);

}

 

@Transactional

@Override

public List<Play> getPlays(){

List<Play> playList = new ArrayList<Play>();

Query query = hibernateTemplate.getSessionFactory().getCurrentSession().createQuery("from Play");

playList = query.list();

return playList;

}

 

 

}

 

Листинг SeasonDAOImpl.java

 

package com.profitsoft.daoimpl;

 

import org.apache.log4j.Logger;

import org.hibernate.Session;

import org.hibernate.SessionFactory;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.orm.hibernate3.HibernateTemplate;

import org.springframework.stereotype.Repository;

import org.springframework.transaction.annotation.Transactional;

 

import com.profitsoft.DAO.SeasonDAO;

import com.profitsoft.model.Season;

 

 

@Transactional

@Repository

public class SeasonDAOImpl implements SeasonDAO {

private static final Logger log = Logger.getLogger(SeasonDAOImpl.class);

private HibernateTemplate hibernateTemplate;

 

public void setHibernateTemplate(SessionFactory sessionFactory){

this.hibernateTemplate = new HibernateTemplate(sessionFactory);

}

 

 

@Override

public void insertSeason(Season season) {

hibernateTemplate.save(season);

log.warn("Season inserted");

}

 

@Override

public void deleteSeason(Season season) {

season.getShow().getSeasons().remove(season);

hibernateTemplate.delete(season);

log.warn("Season deleted");

}

 

@Override

public void updateSeason(Season season, int id) {

hibernateTemplate.save(season);

log.warn("Season updated");

}

 

@Override

public Season findSeason(int id) {

return (Season)hibernateTemplate.get(Season.class, id);

}

 

}

 

Листинг ShowDAOImpl.java

 

package com.profitsoft.daoimpl;

 

import org.apache.log4j.Logger;

import org.hibernate.SessionFactory;

import org.springframework.orm.hibernate3.HibernateTemplate;

import org.springframework.stereotype.Repository;

import org.springframework.transaction.annotation.Transactional;

 

import com.profitsoft.DAO.ShowDAO;

import com.profitsoft.model.Show;

 

@Transactional

@Repository

public class ShowDAOImpl implements ShowDAO {

final Logger log = Logger.getLogger(ShowDAOImpl.class);

private HibernateTemplate hibernateTemplate;

 

public void setHibernateTemplate(SessionFactory sessionFactory){

this.hibernateTemplate = new HibernateTemplate(sessionFactory);

}

 

@Override

public void insertShow(Show show) {

hibernateTemplate.save(show);

log.warn("Show inserted.");

}

 

@Override

public void deleteShow(Show show) {

hibernateTemplate.delete(show);

log.warn("Show deleted.");

 

}

 

@Override

public void updateShow(Show show, int id) {

hibernateTemplate.save(show);

log.warn("Show updated");

}

 

@Override

public Show findShow(int id) {

return (Show)hibernateTemplate.get(Show.class, id);

}

 

}

 

Листинг Play.java

 

package com.profitsoft.model;

 

import java.util.HashSet;

import java.util.Set;

 

 

 

public class Play {

private int id;

private String name;

private String author;

private String genre;

private Show show;

private Set<Season> seasons = new HashSet<Season>();

 

public void addSeason(Season Season) {

this.getSeasons().add(Season);

Season.addPlay(this);

}

 

public int getId() {

return id;

}

public void setId(int id) {

this.id = id;

}

public String getName() {

return name;

Информация о работе Розробка веб-системи продажі білетів театру