Semester Project

Final Exam

Attendance minute paper: name, expectations for the final format. 

Homework Ten: will be posted tomorrow. 

--

Absolutely, we described that at the end of the lab.

Here's another map:

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

We'll go over this a little bit later in lab.

--

[huntingm@silo squash]$ pwd
/u/huntingm/c212-workspace/apache-tomcat-7.0.35/webapps/squash
[huntingm@silo squash]$ ls -l
total 12
-rw------- 1 huntingm students 109 Nov 27 10:47 index.html
-rw------- 1 huntingm students 518 Nov 27 10:48 one.html
-rw------- 1 huntingm students  51 Nov 27 10:37 one.jsp
drwx------ 4 huntingm students  63 Nov 27 10:43 WEB-INF
[huntingm@silo squash]$ cat one.html
<html>
  <head>
    <title>
      My form the week of 01/18/2017
    </title>
  </head>
  <body>

    <form action=/squash/servlet/Radish 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>
[huntingm@silo squash]$ cat one.jsp
I am a JSP. The time is: <%=new java.util.Date()%>
[huntingm@silo squash]$ tree .
.
├── index.html
├── one.html
├── one.jsp
└── WEB-INF
    ├── classes
    │   ├── One.class
    │   └── One.java
    ├── lib
    └── web.xml

3 directories, 6 files
[huntingm@silo squash]$ cat WEB-INF/classes/One.java
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class One extends HttpServlet {
  public void doGet(HttpServletRequest request,
                    HttpServletResponse response) throws IOException, ServletException {
    String name = request.getParameter("who");
    String age = request.getParameter("age");

    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("Well, " + name + " you will be " + (age + 1) + " next year.");
  }
}
[huntingm@silo squash]$ cat WEB-INF/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>radijs</servlet-name>
    <servlet-class>One</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>radijs</servlet-name>
    <url-pattern>/servlet/Radish</url-pattern>
  </servlet-mapping>

</web-app>
[huntingm@silo squash]$

-- 

[huntingm@silo squash]$ history
  [...]
  858  pwd
  859  ls
  860  mkdir c212-workspace
  861  clear
  862  ls -l
  863  cd c212-workspace/
  864  clear
  865  ls -l
  866  cp /l/www/classes/a348/spr2013/software/apache-tomcat-7.0.35.tar.gz .
  867  ls -l
  868  gunzip apache-tomcat-7.0.35.tar.gz
  869  ls -l
  870  tar xvf apache-tomcat-7.0.35.tar
  871  clear
  872  pwd
  873  ls -l
  874  rm apache-tomcat-7.0.35.tar
  875  ls -l
  876  cd apache-tomcat-7.0.35/
  877  ls -l
  878  cd conf
  879  ls -l
  880  netstat -a | grep 8346
  881  clear
  882  netstat -a | grep 31415
  883  netstat -a | grep 31915
  884  netstat -a | grep 31916
  885  clear
  886  pwd
  887  ls -l
  888  mv server.xml server.xml-distr
  889  ls
  890  ls -l
  891  nano -w server.xml
  892  clear
  893  cd ..
  894  pwd
  895  ls -l
  896  cd ..
  897  pwd
  898  ls -l
  899  pwd
  900  ls -l
  901  nano -w .tomcat-settings
  902  clear
  903  pwd
  904  ls -l
  905  ls -l .tomcat-settings
  906  ls -l
  907  echo $JAVA_HOME
  908  source .tomcat-settings
  909  echo $JAVA_HOME
  910  echo $CATALINA_HOME
  911  echo $CLASSPATH
  912  cat .tomcat-settings
  913  clear
  914  $CATALINA_HOME/bin/startup.sh
  915  pwd
  916  ls -l
  917  cd apache-tomcat-7.0.35/
  918  cd $CATALINA_HOME
  919  echo $CATALINA_HOME
  920  ls -l
  921  cd webapps/
  922  clear
  923  ls -l
  924  cd ROOT/
  925  ls -l
  926  tree WEB-INF/
  927  nano -w index.html
  928  clear
  929  pwd
  930  cd $CATALINA_HOME/conf
  931  ls -l
  932  ps -ef | grep hunt
  933  $CATALINA_HOME/bin/shutdown.sh
  934  ps -ef | grep hunt
  935  clear
  936  ps -ef | grep hunt
  937  pwd
  938  nano -w server.xml
  939  $CATALINA_HOME/bin/startup.sh
  940  pwd
  941  clear
  942  pwd
  943  nano -w $CATALINA_HOME/webapps/ROOT/index.html
  944  pwd
  945  cd ../webapps/
  946  ls -l
  947  mkdir squash
  948  cd squash/
  949  pwd
  950  nano -w index.html
  951  nano -w one.jsp
  952  clear
  953  pwd
  954  cd $CATALINA_HOME
  955  ls
  956  clear
  957  ls -l
  958  ls work/
  959  ls work/Catalina/
  960  ls work/Catalina/localhost/
  961  ls work/Catalina/localhost/squash/
  962  ls work/Catalina/localhost/squash/org/
  963  ls work/Catalina/localhost/squash/org/apache/
  964  ls work/Catalina/localhost/squash/org/apache/jsp/
  965  ls work/Catalina/localhost/squash/org/apache/jsp/one_jsp.java
  966  more work/Catalina/localhost/squash/org/apache/jsp/one_jsp.java
  967  cd $CATALINA_HOME
  968  clear
  969  cd webapps/
  970  cd squash/
  971  ls -l
  972  mkdir WEB-INF
  973  cd WEB-INF/
  974  mkdir classes
  975  mkdir lib
  976  clear
  977  pwd
  978  ls -l
  979  cd ..
  980  clear
  981  pwd
  982  ls -l
  983  cd ..
  984  tree squash/
  985  clear
  986  pwd
  987  ls
  988  cd squash/
  989  cd WEB-INF/
  990  cd classes/
  991  nano -w One.java
  992  javac One.java
  993  cd ..
  994  pwd
  995  clear
  996  ls -l
  997  nano -w web.xml
  998  cat web.xml
  999  cd classes/
 1000  $JAVA_HOME/bin/javac One.java
 1001  $CATALINA_HOME/bin/shutdown.sj
 1002  $CATALINA_HOME/bin/shutdown.sh
 1003  $CATALINA_HOME/bin/startup.sh
 1004  clear
 1005  pwd
 1006  cd ..
 1007  ls -l
 1008  nano -w one.html
 1009  nano -w index.html
 1010  nano -w one.html
 1011  clear
 1012  pwd
 1013  ls -l
 1014  cat one.html
 1015  cat one.jsp
 1016  tree .
 1017  cat WEB-INF/classes/One.java
 1018  cat WEB-INF/web.xml
 1019  historyclear
 1020  clear
 1021  history
[huntingm@silo squash]$