0% found this document useful (0 votes)
12 views13 pages

JDBCCC

The document outlines the structure and content of a web application called PopcornFlix, which includes various JSP pages for home, movies, movie details, login, and contact functionalities. It features a navigation menu, sections for trending movies, a search function, and a table of popular movies with details like title, genre, release year, and rating. Additionally, it includes servlet configurations for handling user login and contact forms, along with error handling for 404 and 500 errors.

Uploaded by

22501a12a4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views13 pages

JDBCCC

The document outlines the structure and content of a web application called PopcornFlix, which includes various JSP pages for home, movies, movie details, login, and contact functionalities. It features a navigation menu, sections for trending movies, a search function, and a table of popular movies with details like title, genre, release year, and rating. Additionally, it includes servlet configurations for handling user login and contact forms, along with error handling for 404 and 500 errors.

Uploaded by

22501a12a4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

POPCORNFLIX

Index.jsp :
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-
8"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PopcornFlix!</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<div class="logo">POPCORNFLIX</div>
<nav>
<ul>
<li><a href="index.jsp">Home</a></li>
<li><a href="series.jsp">Series</a></li>
<li><a href="movies.jsp">Movies</a></li>
<li><a href="popular.jsp">New & Popular</a></li>
<li><a href="mylist.jsp">My List</a></li>
</ul>
</nav>
</header>

<main>
<section class="hero">
<div class="hero-content">
<h1>Unlimited movies, TV shows, and more.</h1>
<p>Watch anywhere, anytime.</p>
<button>Join Now</button>
</div>
</section>

<section class="movie-row">
<h2>Trending Now</h2>
<div class="movie-list">
<div class="movie-item">
<img src="https://tse1.mm.bing.net/th?
id=OIP.EOjBrIp3i1aijHnNFCyoaAHaFj&pid=Api&P=0&h=180" alt="Movie 1">
</div>
<div class="movie-item">
<img
src="https://image.tmdb.org/t/p/original/gj0fKa4jjwxZLmVq7I8tv13V45.jpg" alt="Movie
2">
</div>
<div class="movie-item">
<img
src="https://m.mediaamazon.com/images/M/MV5BMTg5MzUxNzgxNV5BMl5BanBnXkFt
ZTgwMTM2NzQ3MjI@._V1_.jpg" alt="Movie 3">
</div>
<div class="movie-item">
<img
src="https://m.mediaamazon.com/images/M/MV5BZWZiOWUzNDgtMjlkMi00ZjFmLTk1O
TgtMGEzMDE3YjVjNTYzXkEyXkFqcGdeQXVyMTMxODk2OTU@._V1_.jpg"
alt="Movie 4">
</div>
</div>
</section>

<section class="movie-search">
<h2>Search for Movies</h2>
<form action="search.jsp" method="get">
<input type="text" name="query" placeholder="Search movies..." required>
<button type="submit">Search</button>
</form>
</section>

<section class="movie-table">
<h2>Popular Movies</h2>
<table>
<thead>
<tr>
<th>Title</th>
<th>Genre</th>
<th>Release Year</th>
<th>Rating</th>
</tr>
</thead>
<tbody>
<tr>
<td>Oppenheimer</td>
<td>Thriller</td>
<td>2023</td>
<td>8.3</td>
</tr>
<tr>
<td>Tenet</td>
<td>Sci-Action</td>
<td>2020</td>
<td>8.2</td>
</tr>
<tr>
<td>Inception</td>
<td>Drama</td>
<td>2010</td>
<td>9.0</td>
</tr>
<tr>
<td>Man of Steel</td>
<td>Sci-Action</td>
<td>2013</td>
<td>7.9</td>
</tr>
</tbody>
</table>
</section>
</main>
</body>
</html>

Web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">

<!-- Application Display Name -->


<display-name>PopcorFlix</display-name>

<!-- Welcome File List -->


<welcome-file-list>
<welcome-file>home.jsp</welcome-file>
</welcome-file-list>

<!-- Servlet Configurations (if needed) -->


<!-- You can add servlets here if required for login actions, movie handling, etc. -->

<!-- Example of servlet configuration for handling login -->


<servlet>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>com.popcorflix.LoginServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/loginAction.jsp</url-pattern>
</servlet-mapping>

<!-- Servlet for handling contact form -->


<servlet>
<servlet-name>ContactServlet</servlet-name>
<servlet-class>com.popcorflix.ContactServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>ContactServlet</servlet-name>
<url-pattern>/contactAction.jsp</url-pattern>
</servlet-mapping>

<!-- Security Configurations (optional) -->


<!-- Example of security constraint to restrict access to certain pages -->
<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>/movies.jsp</url-pattern>
<url-pattern>/movieDetails.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>user</role-name>
</auth-constraint>
</security-constraint>

<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/login.jsp?error=true</form-error-page>
</form-login-config>
</login-config>

<!-- Error Handling -->


<error-page>
<error-code>404</error-code>
<location>/error404.jsp</location>
</error-page>

<error-page>
<error-code>500</error-code>
<location>/error500.jsp</location>
</error-page>
</web-app>

Home.jsp:

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


8"%>
<!DOCTYPE html>
<html>
<head>
<title>PopcorFlix - Home</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<header>
<h1>Welcome to PopcorFlix</h1>
<nav>
<a href="movies.jsp">Movies</a> |
<a href="login.jsp">Login</a> |
<a href="contact.jsp">Contact Us</a>
</nav>
</header>

<main>
<h2>Stream the Latest and Greatest Movies!</h2>
<p>Explore our collection of blockbuster hits and hidden gems.</p>
</main>

<footer>
<p>&copy; 2024 PopcorFlix. All Rights Reserved.</p>
</footer>
</body>
</html>

Movies.jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-
8"%>
<!DOCTYPE html>
<html>
<head>
<title>PopcorFlix - Movies</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<header>
<h1>PopcorFlix - Movie Library</h1>
<nav>
<a href="home.jsp">Home</a> |
<a href="login.jsp">Login</a> |
<a href="contact.jsp">Contact Us</a>
</nav>
</header>

<main>
<h2>Available Movies</h2>
<ul>
<li><a href="movieDetails.jsp?movieId=1">Inception</a></li>
<li><a href="movieDetails.jsp?movieId=2">The Dark Knight</a></li>
<li><a href="movieDetails.jsp?movieId=3">Interstellar</a></li>
<li><a href="movieDetails.jsp?movieId=4">Parasite</a></li>
</ul>
</main>
<footer>
<p>&copy; 2024 PopcorFlix. All Rights Reserved.</p>
</footer>
</body>
</html>

movieDetails.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-
8"%>
<%
String movieId = request.getParameter("movieId");
String movieTitle = "";
String movieDescription = "";

switch(movieId) {
case "1":
movieTitle = "Inception";
movieDescription = "A mind-bending thriller by Christopher Nolan.";
break;
case "2":
movieTitle = "The Dark Knight";
movieDescription = "Batman faces the Joker in this action-packed epic.";
break;
case "3":
movieTitle = "Interstellar";
movieDescription = "A space odyssey about love and time.";
break;
case "4":
movieTitle = "Parasite";
movieDescription = "A dark comedy-drama about class disparity.";
break;
default:
movieTitle = "Unknown Movie";
movieDescription = "Movie not found.";
break;
}
%>
<!DOCTYPE html>
<html>
<head>
<title><%= movieTitle %> - PopcorFlix</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<header>
<h1><%= movieTitle %></h1>
<nav>
<a href="home.jsp">Home</a> |
<a href="movies.jsp">Movies</a> |
<a href="login.jsp">Login</a> |
<a href="contact.jsp">Contact Us</a>
</nav>
</header>

<main>
<h2>Description</h2>
<p><%= movieDescription %></p>
</main>

<footer>
<p>&copy; 2024 PopcorFlix. All Rights Reserved.</p>
</footer>
</body>
</html>

login.jsp:

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


8"%>
<!DOCTYPE html>
<html>
<head>
<title>PopcorFlix - Login</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<header>
<h1>Login to PopcorFlix</h1>
<nav>
<a href="home.jsp">Home</a> |
<a href="movies.jsp">Movies</a> |
<a href="contact.jsp">Contact Us</a>
</nav>
</header>

<main>
<form action="loginAction.jsp" method="post">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required><br><br>

<label for="password">Password:</label>
<input type="password" id="password" name="password" required><br><br>
<button type="submit">Login</button>
</form>
</main>

<footer>
<p>&copy; 2024 PopcorFlix. All Rights Reserved.</p>
</footer>
</body>
</html>

contact.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-
8"%>
<!DOCTYPE html>
<html>
<head>
<title>PopcorFlix - Contact Us</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<header>
<h1>Contact Us at PopcorFlix</h1>
<nav>
<a href="home.jsp">Home</a> |
<a href="movies.jsp">Movies</a> |
<a href="login.jsp">Login</a>
</nav>
</header>

<main>
<form action="contactAction.jsp" method="post">
<label for="name">Your Name:</label>
<input type="text" id="name" name="name" required><br><br>

<label for="email">Your Email:</label>


<input type="email" id="email" name="email" required><br><br>

<label for="message">Your Message:</label><br>


<textarea id="message" name="message" rows="5" cols="40"
required></textarea><br><br>

<button type="submit">Send Message</button>


</form>
</main>

<footer>
<p>&copy; 2024 PopcorFlix. All Rights Reserved.</p>
</footer>
</body>
</html>

You might also like