Embed
Email

notes

Document Sample
notes
Shared by: HC111111023329
Categories
Tags
Stats
views:
0
posted:
11/10/2011
language:
English
pages:
3
CS 320 Notes

01-04-2006

Steven Emory



Three-Tier Architecture



The three-tier architecture is a common architecture for the web. It has three parts: 1.)

client/presentation tier 2.) business logic tier and 3.) storage tier.



Presentation Tier Business Logic Tier Storage Tier

Browser Application Server Database

HTML / JS / CSS JSP Servlet JDBC

Flash + other client-side Java Beans

technologies



N-Tier Architecture



The N-tier architecture expands on the three-tier architecture by the addition of software

running on the server-side which interacts with components in business logic portion of

the three-tier architecture. Every time you add a new software component, you add

another tier. For n-tier architectures, n must be greater than 3.



Additional Software Components

E-mail Software

FTP Software

RMI (Remote Method Invocation)

CORBA (Common Object Request Broker Architecture)

WebServices



Components of the n-tier architecture are covered in CS 420 (enterprise architecture).



Tomcat Installation



You can download Apache Tomcat from http://tomcat.apache.org/. The latest version

should be 5.5.20. Download the Windows Service Installer version and install Tomcat

5.5.20; it will install Tomcat into the C:/Program Files/Apache Software

Foundation/Tomcat 5.5/ directory.



Tomcat 5.5\webapps\ROOT  where your JSP files go.

Tomcat 5.5\webapps\ROOT\WEB-INF  where your JavaBeans go.



A Simple JSP Sample



Here is a sample JSP file, test.jsp. Put it in the root directory and then start up your web

browser and point it to http://localhost:8080/test.jsp?firstparam=CS320. You should get

no errors and a page that says “firstparam = CS320” should appear.

Sample JSP File (test.jsp)











firstparam = // expression tag





When looking at the HTLM code generated by Tomcat (if using Internet Explorer choose

ViewSource from the main menu), you should see something like the following:



HTML Source Generated by Tomcat









firstparam = CS320





Note that there is no JSP scriplet code visible to the user. You only see HTML. The logic

behind the server-sided technology can be hidden as it’s all on the backend and you only

see the output. The following is how Tomcat converts JSP files into the HTML that the

user sees: JSP (App Server)  Servlet (.java file)  Class (.class file)  JVM  HTML

 User.



To find the servlet and class files generated by Tomcat, do a file search in the \Tomcat

5.5\work\Catalina\ directory, as they may be put several folder levels deep.



Note that since JSP files are converted into servlets, if a JSP file is modified and then

uploaded, the web server must compile it into a servlet, otherwise the old servlet will still

be used. This process (upload new JSP  servlet container compiles new JSP to new

servlet automatically) is not always guaranteed, which means you might have to

manually do the compilation yourself (this is not a problem with ASP .NET as ASP is

always interpreted and nothing is compiled).



Editing Application Behavior at the Java Code Level



Server-sided JSP applications and be edited not only by modifying the JSP code and

recompiling, but also by taking the generated .java files (which are placed in the work

directory) and recompiling into .class files. The generated code is pretty unreadable, but

if you look at the Java JDK documentation online (i.e. class HTTPServletRequest ect.),

you can manually add code later to do things such as add and remove cookies.



Using the CSULA Servlet Container

You don’t have to install Tomcat to test your JSP code, as you can use CSULA’s servlet

container. Here are the steps to get it to work:



1.) Get a user name (cs320stuXX) and password from the instructor.

2.) Download a free FTP program such as SSH from http://www.ssh.com. They have

free versions intended for non-commercial use at

http://www.ssh.com/support/downloads/secureshellwks/non-commercial.html.

3.) The hostname for the server is cs3.calstatela.edu. The username is the given

username. Leave the port value unchanged.

4.) Upload your JSP files and place them in the WWW directory.



Lab Work



Make a welcome JSP page where the first URL parameter must be Jeff, otherwise the

page displays an error.













Hello Jeff. How are you?



, you're not Jeff!






Related docs
Other docs by HC111111023329
DrSRS
Views: 0  |  Downloads: 0
originoflife3
Views: 1  |  Downloads: 0
Grid 20Workflow
Views: 0  |  Downloads: 0
ERP Comparison2009
Views: 3  |  Downloads: 0
code camp speakers and sessionsv7msf
Views: 0  |  Downloads: 0
ofertas
Views: 7  |  Downloads: 0
Ch32
Views: 0  |  Downloads: 0
Technical 20Training 20Schedule
Views: 0  |  Downloads: 0
The 20Meaning 20of 20Life
Views: 0  |  Downloads: 0
By registering with docstoc.com you agree to our
privacy policy

You are almost ready to download!

You are almost ready to download!