Giter Club home page Giter Club logo

presidentsweb's Introduction

Summary

A collaborative Java web-app developed with eclipse that displays information on presidents of the United States based on user input.

In This Document

  1. How to Execute
  2. Class Structure Overview

How to Execute

  • The web-app is hosted on: insert URL here
  • Download the entire program as a .war file here

Instructions

  1. User arrives on landing page.
  2. User can select president based on term #
  3. Information is displayed on chosen president.
  4. User can navigate forwards or backwards. When user gets to the end or the beginning, arrows will take them back to the other end.
  5. User can also click on 'Go Back' to get back to dropdown menu.

Class Structure Overview

  • The PresServlet class is the controller and interacts with the PresDAOImpl class which implements methods declared in the PresDAO interface. The president object and list objects are constructed using information from the President class and accompanying .txt and .csv files.
  • The PresServlet provides information back through a .jsp file for the user to view and chooses what president's information (name, term years, picture, facts, etc.) will be displayed based upon if-logic located in the servlet that evaluates user navigation in put.

example of back-button

<a href="start.do?back=back&id=${presData[term-1].termNumber}">&#9756;</a>

example of back-button logic on servlet

if (back != null) {
				try {
					term2 = term - 1;
					if (term == 1) {
						term2 = 45;
					}
					req.setAttribute("id", id);
					req.setAttribute("presData", data);
					req.setAttribute("term", term2);
					req.getRequestDispatcher("/Output.jsp").forward(req, resp);
				} catch (Exception e) {
					req.setAttribute("presData", data);
					req.setAttribute("term", term2);
					req.getRequestDispatcher("/Output.jsp").forward(req, resp);}
  • The JavaServer Pages included references to stylesheets and the use of bootstrap which enables the use of the 'baseball-like' card format on unordered lists, which displays the president data.
<div class="card">
                <ul class="list-group list-group-flush">
                    <img class="portrait" src="./PresPics/${presData[term-1].photo}" alt="president pic">
                    <li><h1>${presData[term-1].firstName} ${presData[term-1].lastName}</h1></li>
                    <li><h3>${presData[term-1].termYear}</h3></li>
                    <li id ="party" class="list-group-item">${presData[term-1].party} Party</li>
                    <li class="list-group-item">${presData[term-1].fact}</li>
                </ul>
            </div>

###Chart of responsibilities

presidentsweb's People

Contributors

chiangs avatar kumar72 avatar hesitatetowonder avatar

Watchers

James Cloos avatar

Forkers

kumar72

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.