What is Tomcat? HTTP web server. HTTP means Hypertext Transfer Protocol. 

What is Catalina? Servlet container in Tomcat. 

What is Java? Programming language. 

What is Jakarta? Foundation/project. 

What is Apache? HTTP web server also a foundation.

What is Rawhide? Code name for a president. 

Establish a web server in our accounts. 

We also want to be able to program it in Java. 

I would like to show how you can program Java Server Pages. 

Do you know HTML at all? Hypertext Markup Language. 

So we can function we have to remember the folder structure in Tomcat. 

What are environment variables? 

What is ~/.bash_profile?

What is ~/.profile? 

What is ~?

Where is Tomcat? 

Name some folders in Tomcat. 

bin, conf, webapps, logs, work and a few others.

What is (in) webapps? 

webapps contains folders named (application) contexts.

The structure of these contexts is fixed: 

  inside the context you can place applets, .html files and .jsp files
   
    note: index.html is a somewhat special file  

  inside the context there is also a WEB-INF folder 

  inside the WEB-INF you can have three types of files:

    a classes folder will contain your servlets 

    a lib folder will contain your drivers 

    a web.xml used to deploy servlets 

Let's create a simple context now. 

[tblgrant@silo webapps]$ mkdir 11062012
[tblgrant@silo webapps]$ cd 11062012/
[tblgrant@silo 11062012]$ mkdir WEB-INF
[tblgrant@silo 11062012]$ cd WEB-INF/
[tblgrant@silo WEB-INF]$ mkdir classes
[tblgrant@silo WEB-INF]$ mkdir lib
[tblgrant@silo WEB-INF]$ pwd
/u/tblgrant/apache-tomcat-5.5.17/webapps/11062012/WEB-INF
[tblgrant@silo WEB-INF]$ cd ..
[tblgrant@silo 11062012]$ pwd
/u/tblgrant/apache-tomcat-5.5.17/webapps/11062012
[tblgrant@silo 11062012]$ du -a .
4       ./WEB-INF/classes
4       ./WEB-INF/lib
12      ./WEB-INF
16      .
[tblgrant@silo 11062012]$

I wonder if I am a manager and if so what is my username and password. 

I look it up in $CATALINA_HOME/conf/tomcat-users.xml 

Now I go into the context and create index.html.

I also create one.html that looks like this:

<html>
  <head>
    <title>
      Interface
    </title>
  </head>
  <body> 
    <form action="one.jsp">
      Name: <input type=text name=person>       
    </form> 
  </body>
</html>

The file one.jsp is there but also very empty. 

I access this interface at:

http://silo.cs.indiana.edu:21130/11062012/one.html

I then write Laura in the text field and press Enter. 

The URL changes to: 

http://silo.cs.indiana.edu:21130/11062012/one.jsp?person=Laura

So our empty JSP was called with person=Laura

But being empty it gives us that output

So, what do we do next? 

Let's finish the interface. 

Then write a meaningful JSP? 

Or we can write a short JSP to match this interface we have right now. 

So let's the second approach.

Here's the new JSP explained:

[tblgrant@silo 11062012]$ cat one.jsp
<%

 String name = request.getParameter("person");

 %>

Hi, <%=name%>, we are not open yet. We open at 10:45am. <p>

The time is now <%=new java.util.Date()%>
[tblgrant@silo 11062012]$

Now using the interface we can send a name and get a customized reply. 

Next time: 

  (a) finish the interface and the JSP

  (b) what are servlets and what's their relationship with JSPs?

--