Class 2 |
Intermediate Java 30-IT-397 |
|
JSPs/Servlets in This Class
-
For the most part, we get to re-use a lot of what we already know about
Java.
-
Servlets are simply Java classes that output HTML.
-
Think of it this way. Imagine writing HTML in your System.out.println()
statements. That's pretty much all we are doing.
-
There is more to know about Servlets, but the basics aren't that difficult.
As a matter of fact, you can let Forte' generate the source code, and all
you have to do is put the HTML in a method!
-
The drawback: all of those darn print statements.
-
JSPs are a little different.
-
You still use Java, but you use it in an HTML page.
-
If you're more comfortable with HTML and you don't want to write all of
the print statements, you might want to use JSPs.
-
The end result is the same. JSPs compile into Servlets!
-
The drawback: your presentation and logic are together. Thus, your
graphics people and programmers mess up each others' work.
-
Not very object oriented.
-
Then came tags.
-
Tags allow you to put your logic in Java classes, and have the output generated
via custom tags in the JSP.
-
A nice solution.
-
The drawback: you have to learn some new skills for this, and you have
to mess with configuration files.
-
Then came Struts.
-
Struts is a framework
that uses all of the above and puts it in a Model-View-Controller design.
-
It is developed by Apache, the
same folks who gave us Tomcat.
-
Very object oriented.
-
Again, a big learning curve.
-
This is becoming very popular. We're adopting it at the bank.
We probably will not have time to cover it in class, though...
Where do we put them?

Created by: Brandan Jones
December 17, 2001