Java Web Programming



               Week 1
what is web programming?
Why Can’t We Have a Simple Java
            Main Class?

   How do I         How do you        How do the world
talk to a class?   talk to a class?    talk to a class?
YEAH I KNOW THAT! THAT’S HTTP, XML,
(X)HTML(5), WS .. ALL THOSE RUBBISH!
BUT..




Source:http://onjava.com
Some Movie Stars’ Names For Rest Of
      Your Life To Dream On!
Web Server/Servlet Container/Application
Server

HTTP/HTTPS : All of em’ understand these guys!

GET/POST .. again?

Browser : a genius!
Web/Application Servers
http://www.yarlithub.org:8080/yschool/crash/oops.html

                       Apache
                                               IIS



                           Websphere
                                                 weblogic




              Jetti!                   Netti
Model View Controller
Bite on JSP/Servlet
+ Servlet is your controller!
+ Container understand which request is for which
  servlet!
+ Servlet can read the request, “call the friend” if doesn’t
  know the answer! Then write the response.
   + That friend can be a “Model” Or a “Service”!
+ What is written in the response is the “VIEW” .. HTML

   Servlet is the controller, response is the view & person who
   knows the answer is the model!
Sample Servlet




Source : http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/Servlet-Tutorial-First-Servlets.html
Result in Browser




http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/Servlet-Tutorial-First-Servlets.html
Wait A Sec .. Where is this damn JSP?

 We should have
   – THINK
 written the html
content into a file!



                 If files vary then its
                 fine! … But if the
                 content vary?
An ultimate web application!
--

Java web programming