Howdy. 

Stage One for gamers: BigBang, World, minimal Game. 

Stage One for web developers: JSP, servlet, manager role. 

Stage Two for gamers: Ripples (BigBang test). 

Stage Two for web developers: the model (database). 

Stage Three for gamers: a game. 

Stage Three for web developers: Controllers and Views. 

--

[nmatlock@silo ~]$ cd c212-workspace/
[nmatlock@silo c212-workspace]$ cat .tomcat-settings
JAVA_HOME=/usr/lib/jvm/java-1.8.0
export JAVA_HOME

CATALINA_HOME=/u/nmatlock/c212-workspace/apache-tomcat-7.0.35
export CATALINA_HOME

CLASSPATH=.:$CATALINA_HOME/lib/servlet-api.jar
export CLASSPATH
[nmatlock@silo c212-workspace]$ source .tomcat-settings
[nmatlock@silo c212-workspace]$ echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0
[nmatlock@silo c212-workspace]$

Once in I will create a new context. 

[nmatlock@silo c212-workspace]$ pwd
/u/nmatlock/c212-workspace
[nmatlock@silo c212-workspace]$ cd $CATALINA_HOME
[nmatlock@silo apache-tomcat-7.0.35]$ ls
bin  conf  lib  LICENSE  logs  NOTICE  RELEASE-NOTES  RUNNING.txt  temp  webapps  work
[nmatlock@silo apache-tomcat-7.0.35]$ ls -l
total 96
drwx------ 2 nmatlock students  4096 Jul 12 08:31 bin
drwx------ 3 nmatlock students   238 Jul 12 08:38 conf
drwx------ 2 nmatlock students  4096 Jul 12 08:31 lib
-rw------- 1 nmatlock students 56812 Jan 10  2013 LICENSE
drwx------ 2 nmatlock students   178 Jul 12 08:38 logs
-rw------- 1 nmatlock students  1192 Jan 10  2013 NOTICE
-rw------- 1 nmatlock students  8826 Jan 10  2013 RELEASE-NOTES
-rw------- 1 nmatlock students 16163 Jan 10  2013 RUNNING.txt
drwx------ 2 nmatlock students    30 Jul 12 08:31 temp
drwx------ 7 nmatlock students   105 Jan 10  2013 webapps
drwx------ 3 nmatlock students    30 Jul 12 08:38 work
[nmatlock@silo apache-tomcat-7.0.35]$ cd webapps/
[nmatlock@silo webapps]$ ls
docs  examples  host-manager  manager  ROOT
[nmatlock@silo webapps]$ mkdir eggplant
[nmatlock@silo webapps]$ cd eggplant/
[nmatlock@silo eggplant]$ mkdir WEB-INF
[nmatlock@silo eggplant]$ cd WEB-INF/
[nmatlock@silo WEB-INF]$ mkdir lib
[nmatlock@silo WEB-INF]$ mkdir classes
[nmatlock@silo WEB-INF]$ cd ..
[nmatlock@silo eggplant]$ tree .
.
└── WEB-INF
    ├── classes
    └── lib

3 directories, 0 files
[nmatlock@silo eggplant]$ pwd
/u/nmatlock/c212-workspace/apache-tomcat-7.0.35/webapps/eggplant
[nmatlock@silo eggplant]$

I will develop a simple servlet in here. 

$CATALINA_HOME --+-- webapps --+-- cricket --+-- WEB-INF --+-- classes --+-- One.java
                 |             |             |             |
                 |             |             |             +-- lib 
                 |             |             |             | 
                 |             |             |             +--- web.xml
                 |             |             |
                 |             |             +-- one.html
                 |             |             |
                 |             |             +-- index.html
                 |             |  
                 |             +-- ROOT ---+-- WEB-INF ... 
                 +-- bin                   | 
                 |                         +-- index.html 
                 +-- conf                 
                 |                         
                 +-- logs
                 |
                 ... 

Given this map I will do the following: 

http://silo.cs.indiana.edu:11745/eggplant/

I will start by making this call more friendly. 

[nmatlock@silo eggplant]$ pwd
/u/nmatlock/c212-workspace/apache-tomcat-7.0.35/webapps/eggplant
[nmatlock@silo eggplant]$ ls -l
total 0
drwx------ 4 nmatlock students 44 Jul 18 14:41 WEB-INF
[nmatlock@silo eggplant]$ nano -w index.html
[nmatlock@silo eggplant]$ cat index.html
Howdy this is the eggplant context. <p>

Here I have an H<a href="one.html">TML interfac</a>e, an<a href="servlet/Something">d a servle</a>t.
[nmatlock@silo eggplant]$

Now if I call I get the file. 

I need to create one.html and the servlet before I can use the links. 

[nmatlock@silo eggplant]$ pwd
/u/nmatlock/c212-workspace/apache-tomcat-7.0.35/webapps/eggplant
[nmatlock@silo eggplant]$ ls -l
total 4
-rw------- 1 nmatlock students 144 Jul 18 14:46 index.html
drwx------ 4 nmatlock students  44 Jul 18 14:41 WEB-INF
[nmatlock@silo eggplant]$ nano -w one.html
[nmatlock@silo eggplant]$ cat one.html
<html>
  <head>
    <title>
      I like eggplants...
    </title>
  </head>
  <body>

    <form action=/eggplant/servlet/Something method=GET>

      <table border>
        <tr>
          <td> Name </td> <td> <input type=text name=who> </td>
        </tr>
        <tr>
          <td> Age </td> <td> <input type=text name=age> </td>
        </tr>
        <tr>
          <td colspan=2> Press <input type=submit value=Submit> to send data to servlet</td>
        </tr>
      </table>
    </form>
  </body>
</html>
[nmatlock@silo eggplant]$

Let's check this online. 

It works and it gives me an idea to modify index.html

[nmatlock@silo eggplant]$ nano -w index.html
[nmatlock@silo eggplant]$ cat index.html
Howdy this is the eggplant context. <p>

Here I have an H<a href="one.html">TML interfac</a>e, an<a href="http://silo.cs.indiana.edu:11745/eggplant/servlet/Something?who=Larry&age=5">d a servle</a>t.
[nmatlock@silo eggplant]$

Now let's set up the server. 

http://tomcat.apache.org/tomcat-7.0-doc/servletapi/javax/servlet/http/HttpServlet.html#doGet(javax.servlet.http.HttpServletRequest,%20javax.servlet.http.HttpServletResponse)

[nmatlock@silo eggplant]$ pwd
/u/nmatlock/c212-workspace/apache-tomcat-7.0.35/webapps/eggplant
[nmatlock@silo eggplant]$ ls -l
total 8
-rw------- 1 nmatlock students 202 Jul 18 14:50 index.html
-rw------- 1 nmatlock students 512 Jul 18 14:48 one.html
drwx------ 4 nmatlock students  44 Jul 18 14:41 WEB-INF
[nmatlock@silo eggplant]$ cd WEB-INF/
[nmatlock@silo WEB-INF]$ cd classes/
[nmatlock@silo classes]$ nano -w One.java
[nmatlock@silo classes]$ ls -l
total 4
-rw------- 1 nmatlock students 514 Jul 18 14:54 One.java
[nmatlock@silo classes]$ javac One.java
Picked up _JAVA_OPTIONS: -Xms512m -Xmx512m
[nmatlock@silo classes]$ ls -l
total 8
-rw------- 1 nmatlock students 1074 Jul 18 14:54 One.class
-rw------- 1 nmatlock students  514 Jul 18 14:54 One.java
[nmatlock@silo classes]$

Now unlike JSPs I need to deploy this servlet. 

[nmatlock@silo classes]$ pwd
/u/nmatlock/c212-workspace/apache-tomcat-7.0.35/webapps/eggplant/WEB-INF/classes
[nmatlock@silo classes]$ ls -l
total 8
-rw------- 1 nmatlock students 1074 Jul 18 14:54 One.class
-rw------- 1 nmatlock students  514 Jul 18 14:54 One.java
[nmatlock@silo classes]$ cd ..
[nmatlock@silo WEB-INF]$ ls -l
total 0
drwx------ 2 nmatlock students 51 Jul 18 14:54 classes
drwx------ 2 nmatlock students 10 Jul 18 14:41 lib
[nmatlock@silo WEB-INF]$ nano -w web.xml
[nmatlock@silo WEB-INF]$ cat web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

  <servlet>
    <servlet-name>iets</servlet-name>
    <servlet-class>One</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>iets</servlet-name>
    <url-pattern>/servlet/Something</url-pattern>
  </servlet-mapping>

</web-app>
[nmatlock@silo WEB-INF]$

Now I am going to access my servlet. 

I did and it turns out needs to be changed and recompiled. 

[nmatlock@silo WEB-INF]$ pwd
/u/nmatlock/c212-workspace/apache-tomcat-7.0.35/webapps/eggplant/WEB-INF
[nmatlock@silo WEB-INF]$ cd classes/
[nmatlock@silo classes]$ ls -l
total 8
-rw------- 1 nmatlock students 1074 Jul 18 14:54 One.class
-rw------- 1 nmatlock students  514 Jul 18 14:54 One.java
[nmatlock@silo classes]$ nano -w One.java
[nmatlock@silo classes]$ javac One.java
Picked up _JAVA_OPTIONS: -Xms512m -Xmx512m
[nmatlock@silo classes]$ ls -ld *
-rw------- 1 nmatlock students 1143 Jul 18 15:03 One.class
-rw------- 1 nmatlock students  532 Jul 18 15:02 One.java
[nmatlock@silo classes]$ date
Tue Jul 18 15:03:06 EDT 2017
[nmatlock@silo classes]$

http://silo.cs.indiana.edu:11745/index.jsp

[nmatlock@silo classes]$ date
Tue Jul 18 15:03:06 EDT 2017
[nmatlock@silo classes]$ pwd
/u/nmatlock/c212-workspace/apache-tomcat-7.0.35/webapps/eggplant/WEB-INF/classes
[nmatlock@silo classes]$ cd $CATALINA_HOME
[nmatlock@silo apache-tomcat-7.0.35]$ cd conf/
[nmatlock@silo conf]$ ls -l
total 204
drwx------ 3 nmatlock students     31 Jul 12 08:38 Catalina
-rw------- 1 nmatlock students  12128 Jan 10  2013 catalina.policy
-rw------- 1 nmatlock students   6392 Jan 10  2013 catalina.properties
-rw------- 1 nmatlock students   1394 Jan 10  2013 context.xml
-rw------- 1 nmatlock students   3288 Jan 10  2013 logging.properties
-rw------- 1 nmatlock students    738 Jul 12 08:44 server.xml
-rw------- 1 nmatlock students   6435 Jan 10  2013 server.xml-distr
-rw------- 1 nmatlock students   1530 Jan 10  2013 tomcat-users.xml
-rw------- 1 nmatlock students 162905 Jan 10  2013 web.xml
[nmatlock@silo conf]$ nano -w tomcat-users.xml
[nmatlock@silo conf]$ cat tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager-gui"/>
<user username="noah" password="narwhal" roles="manager-gui"/>
</tomcat-users>
[nmatlock@silo conf]$

Need to restart the whole server for this to take effect. 

[nmatlock@silo conf]$ $CATALINA_HOME/bin/shutdown.sh
Using CATALINA_BASE:   /u/nmatlock/c212-workspace/apache-tomcat-7.0.35
Using CATALINA_HOME:   /u/nmatlock/c212-workspace/apache-tomcat-7.0.35
Using CATALINA_TMPDIR: /u/nmatlock/c212-workspace/apache-tomcat-7.0.35/temp
Using JRE_HOME:        /usr/lib/jvm/java-1.8.0
Using CLASSPATH:       /u/nmatlock/c212-workspace/apache-tomcat-7.0.35/bin/bootstrap.jar:/u/nmatlock/c212-workspace/apache-tomcat-7.0.35/bin/tomcat-juli.jar
Picked up _JAVA_OPTIONS: -Xms512m -Xmx512m
[nmatlock@silo conf]$ ps -ef | grep matlo
root      44987   3119  0 14:37 ?        00:00:00 sshd: nmatlock [priv]
nmatlock  45239  44987  0 14:38 ?        00:00:00 sshd: nmatlock@pts/22
nmatlock  45240  45239  0 14:38 pts/22   00:00:00 -bash
nmatlock  59536  45240  0 15:07 pts/22   00:00:00 ps -ef
nmatlock  59537  45240  0 15:07 pts/22   00:00:00 grep --color=auto matlo
[nmatlock@silo conf]$ $CATALINA_HOME/bin/startup.sh
Using CATALINA_BASE:   /u/nmatlock/c212-workspace/apache-tomcat-7.0.35
Using CATALINA_HOME:   /u/nmatlock/c212-workspace/apache-tomcat-7.0.35
Using CATALINA_TMPDIR: /u/nmatlock/c212-workspace/apache-tomcat-7.0.35/temp
Using JRE_HOME:        /usr/lib/jvm/java-1.8.0
Using CLASSPATH:       /u/nmatlock/c212-workspace/apache-tomcat-7.0.35/bin/bootstrap.jar:/u/nmatlock/c212-workspace/apache-tomcat-7.0.35/bin/tomcat-juli.jar
[nmatlock@silo conf]$

Confirm online. Reload context everything works. 

--

Post it. 

[nmatlock@silo conf]$ pwd
/u/nmatlock/c212-workspace/apache-tomcat-7.0.35/conf
[nmatlock@silo conf]$ cd ../webapps/ROOT/
[nmatlock@silo ROOT]$ nano -w index.html
[nmatlock@silo ROOT]$ cat index.html
Here's m<a href="eggplant">y stage one f</a>or the web development project. <p>

My name is <span style="color:blue; font-weight:bold">Noah</span>, and I [...] 

[nmatlock@silo ROOT]$