Hi there these are the lab notes as written in class. 

We started with this: 

import java.util.*; 

class One {
  public static void main(String[] ags) {
    Scanner a = new Scanner(System.in); 
    while (true) {
      System.out.print("Enter: "); 
      String line = a.nextLine(); 
      try { 
        int n = Integer.parseInt( line ); 
        System.out.println( n + 0 ); 
        break;
      } catch (Exception e) {
        System.out.println( "(" + line + ") was not an integer, shame on you.");
        System.out.println( e ); 
      }
    }    
    System.out.println( "Thank you, come again.");
    
  }
}

Here's how this works:

Welcome to DrJava.  Working directory is C:\Users\dgerman
> run One
Enter:  [DrJava Input Box]
(4.5) was not an integer, shame on you.
java.lang.NumberFormatException: For input string: "4.5"
Enter:  [DrJava Input Box]
(a) was not an integer, shame on you.
java.lang.NumberFormatException: For input string: "a"
Enter:  [DrJava Input Box]
-2
Thank you, come again.
>

----------------------------------------------------------------------------------------

Next please bring your Tomcat servers down. 

----------------------------------------------------------------------------------------

To verify your server is down do this: ps -ef | grep celgrund

----------------------------------------------------------------------------------------

Make sure your ~/.bash_profile has the environment variables settings:

[celgrund@silo ~]$ tail -8 ~/.bash_profile
EDITOR=pico
export EDITOR

export JAVA_HOME=/usr/lib/jvm/java-1.6.0-sun.x86_64

export CATALINA_HOME=/u/celgrund/apache-tomcat-7.0.35

export CLASSPATH=.:$CATALINA_HOME/lib/servlet-api.jar
[celgrund@silo ~]$

----------------------------------------------------------------------------------------

Next create a simple index.html in $CAALINA_HOME/webapps/ROOT

cd $CATALINA_HOME

cd webapps

cd ROOT

pico -w index.html

Type the following inside: 

<html>
  <head>
    <title>
      This is my first HTML page.
    </title>
  </head>
  <body>
    <ul>
      <li> This is Celia's server. </li>
      <li> My other page is <a href="index.jsp">here</a>. </li>
    </ul>
  </body>
</html>

----------------------------------------------------------------------------------------

[celgrund@silo ROOT]$ pwd
/u/celgrund/apache-tomcat-7.0.35/webapps/ROOT
[celgrund@silo ROOT]$ cd $CATALINA_HOME
[celgrund@silo apache-tomcat-7.0.35]$ cd conf
[celgrund@silo conf]$ ls -ld tomcat-users.xml
-rw------- 1 celgrund students 1530 Jan 10 17:55 tomcat-users.xml
[celgrund@silo conf]$

At the bottom of this file state the role and the username with password that assumes that role. 

<!--
  NOTE:  The sample user and role entries below are wrapped in a comment
  and thus are ignored when reading this file. Do not forget to remove
  <!.. ..> that surrounds them.
-->
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <role rolename="manager-gui"/>
  <user username="celia" password="hedgeh0g" roles="manager-gui"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
-->
</tomcat-users>

Please be sure to wipe out those two comment lines. <!--  and --> surrounding that section. 

Now start your servers: 

    $CATALINA_HOME/bin/startup.sh

Then check the server online: 
 
    http://silo.cs.indiana.edu:14248

----------------------------------------------------------------------------------------

Next let's implement the simple servlet interaction described at:

    http://www.cs.indiana.edu/classes/c212-dgerman/spr2013/labEight.html

Go into webapps: 

[celgrund@silo conf]$ cd $CATALINA_HOME
[celgrund@silo apache-tomcat-7.0.35]$ cd webapps/

Look around: 

[celgrund@silo webapps]$ ls
chat  docs  examples  host-manager  iceblox  manager  ROOT

Make a folder for the new context: 

[celgrund@silo webapps]$ mkdir squash

Move in there: 

[celgrund@silo webapps]$ cd squash/

Make a WEB-INF folder: 

[celgrund@silo squash]$ mkdir WEB-INF

Move in there: 

[celgrund@silo squash]$ cd WEB-INF/

Create lib and classes: 

[celgrund@silo WEB-INF]$ mkdir classes
[celgrund@silo WEB-INF]$ mkdir lib

Move into classes:

[celgrund@silo WEB-INF]$ cd classes/
[celgrund@silo classes]$ pico -w One.java

Create the servlet and compile it. 

[celgrund@silo classes]$ javac One.java

When done move up and create the web.xml file: 

[celgrund@silo classes]$ cd ..
[celgrund@silo WEB-INF]$ pico -w web.xml
[celgrund@silo WEB-INF]$ cd ..

When done move up and create one.html and index.html: 

[celgrund@silo squash]$ pico index.html
[celgrund@silo squash]$ pico -w one.html
[celgrund@silo squash]$ pwd
/u/celgrund/apache-tomcat-7.0.35/webapps/squash

If you modify the servlet and recompile please be sure to reload the context.

[celgrund@silo squash]$ cd WEB-INF/
[celgrund@silo WEB-INF]$ cd classes/
[celgrund@silo classes]$ pico One.java
[celgrund@silo classes]$ javac One.java
[celgrund@silo classes]$

Now reload the context from the manager-gui interface. 

Here's the direct link to the servlet with input: 

http://silo.cs.indiana.edu:14248/squash/servlet/Radish?who=Larry&age=10

Hope this helps. 

--