Skip to content

UCI-Chenli-teaching/cs122b-project2-jsp-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CS 122B Project 2 JSP example

This example shows how JSP works independently.

Before running the example

If you do not have USER mytestuser setup in MySQL, follow the below steps to create it:

  • login to mysql as a root user

    local> mysql -u root -p
    
  • create a test user and grant privileges:

    mysql> CREATE USER 'mytestuser'@'localhost' IDENTIFIED BY 'My6$Password';
    mysql> GRANT ALL PRIVILEGES ON * . * TO 'mytestuser'@'localhost';
    mysql> quit;
    

prepare the database moviedbexample

    local> mysql -u mytestuser -p
    mysql> CREATE DATABASE IF NOT EXISTS moviedbexample;
    mysql> USE moviedbexample;
    mysql> CREATE TABLE IF NOT EXISTS stars(
                   id varchar(10) primary key,
                   name varchar(100) not null,
                   birthYear integer
               );
    
    mysql> INSERT IGNORE INTO stars VALUES('755011', 'Arnold Schwarzeneggar', 1947);
    mysql> INSERT IGNORE INTO stars VALUES('755017', 'Eddie Murphy', 1961);

To run this example:

  1. clone this repository
  2. open Intellij -> Import Project -> Import Project (choose the project you just clone) -> Click on Finish.
  3. Open src/main/webapp/index.jsp. Make sure you have the moviedbexample database.
  4. In Tomcat Deployment Configuration, make sure the application context is: /cs122b-project2-jsp-example
  5. To run the example, follow the instructions in canvas.

Brief Explanation

index.jsp dynamically generates the html page with Java API. It is requested as a static resource, rather than a servlet sample we have seen before. The .jsp file is requested directly.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages