Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Java EE Tutorial


Published on,_and_Servlets_3.0

This tutorial focuses on using Servlet's and JSP the right way. Servlet and JSP have evolved over the years, and now there is often more than one way to do things. For example, this tutorial uses EL and JSTL not JSP scriptlets, it uses JSPs in a Model 2/MVC style not in a model 1 style, etc. Consider it a tutorial that focuses only on the best practices and not the legacy ways to do things.

There are other tutorials on this subject, but this tutorial is going to be different in that it is going to put all code into github, and you can follow along with Eclipse. Also instead of focusing on JSF, we are going to focus on JSP and Servlets as the main view technology.

Java EE, JSP and Servlets have added a lot of features that are in other frameworks, making those other frameworks less relevant then they were before Java EE garnered these extra abilities. Even is you decide to use JSF, Struts, Stripes, Spring MVC, JSF, etc., this tutorial should help you have a better understanding of the JSP/Servlets core that they build on.

We are going to start by building a simple bookstore. We will progressively add more features to the bookstore and as we do we will use more of Java EE/CDI, JSP and Servlets.

For this tutorial, I am going to use Resin 4.0.x, but you could use any Java EE 6 Web Profile compliant application server.

Published in: Technology, Education

Java EE Tutorial

  1. 1. Java  EE  Servlet  3.0  and  JSP  2.2 Caucho  Home    |    Contact  Us    |    Caucho  Blog    |    Wiki    |  Applica8on  ServerThursday, May 3, 12
  2. 2. Open%Source,%Reliable%and%Lightweight% Java%EE%Applica;on%Server% RESIN PRO Web Profile Health System Cloud SupportThursday, May 3, 12
  3. 3. Java  EE  Servlet  and  JSP  tutorial • The  following  will  be  covered: • Servlet  3.0 • JSP • Java  EE  6  Web  Profile   Caucho  Home    |    Contact  Us    |    Caucho  Blog    |    Wiki    |  Applica8on  ServerThursday, May 3, 12
  4. 4. Java  EE  tutorial  focused  on  Servlets  and   Java  Server  Pages  (No  JSF) • Focus  on  Servlets  and  JSP  the  right  way • Servlet  and  JSP  evolved   • Uses  EL  and  JSTL  not  JSP  scriptlets   • JSPs  in  a  Model  2/MVC  style   • No  Model  1 • Focus  is  on  best  prac8ces  and  not  the  legacy  ways  to  do   things Caucho  Home    |    Contact  Us    |    Caucho  Blog    |    Wiki    |  Applica8on  ServerThursday, May 3, 12
  5. 5. Java  EE  Servlets/JSP  versus  frameworks • Ideas  from  Spring  MVC,  Struts,  Tiles,  WebWork  made  it  into   Servlets/JSP  and  Java  EE •  Frameworks  oTen  duplicate  same  func8onality  in  core   Servlet/JSP/Java  EE • JSP  tag  files  versus  Tiles • Standard  valida=on  versus  Struts/Spring  MVC  valida=on • Interna=onaliza=on • It  is  ok  to  use  those  frameworks,  but  you  should  have  a  good   understanding  what  is  in  the  specifica8on  too Caucho  Home    |    Contact  Us    |    Caucho  Blog    |    Wiki    |  Applica8on  ServerThursday, May 3, 12
  6. 6. Tools • For  now  Eclipse  for  Java  EE  IDE  and  Resin • You  can  use  any  Java  EE  6  compliant  applica8on  server  for   most  if  not  all  of  this  tutorial • You  can  also  use  other  IDEs • Later  tutorials  will  support  maven  as  well  as  Eclipse Caucho  Home    |    Contact  Us    |    Caucho  Blog    |    Wiki    |  Applica8on  ServerThursday, May 3, 12
  7. 7. Tutorial  style • Not  going  to  list  every  op8on  of  every  tag,  configura8on,  etc. • Not  going  to  teach  you  something  you  are  suppose  to  avoid  anyway  or   that  is  deprecated  (JSP  scriptlets) • Build  something  real  enough  to  ensure  that  things  actually  work  and  we   dont  miss  something  common  or  important • Dont  build  something  too  real  so  that  the  concepts  are  hard  to  tease   out  of  domain • Provide  cook  books  on  how  to  do  common  tasks  like  I18n,  file  uploads,   working  with  JDBC  etc. • IDE,  Performance  tes8ng,  Debugging,  etc.  from  the  start! Caucho  Home    |    Contact  Us    |    Caucho  Blog    |    Wiki    |  Applica8on  ServerThursday, May 3, 12
  8. 8. Items  that  are  in  scope  for  this  series   (no  par8cular  order) • Eclipse  WTP • File  uploads • Valida8on  (standard,  and   • Quercus JavaScript) • JSP • JDBC  /  RDBMS • Rewrite  rules • WebSockets/Long  polling • Unified  EL • CDI • JMX • Load  Balancing • Tag  files • Session  replica8on • Health   • HTTP  Caching • Servlet  Filters • Cloud  deployment • Server • Performance  tuning          monitoring • Servlet  3  extension   • I18n points • Maven • SOA • JavaScript • JSP  EL • JCache  /  Memcached  /   • JMS • Ajax NoSQL • JDBC • REST • HTML  5 • Clustering  /  Load  balancing • JPA • etc. Caucho  Home    |    Contact  Us    |    Caucho  Blog    |    Wiki    |  Applica8on  ServerThursday, May 3, 12
  9. 9. Out  of  scope • JSF  (maybe  later,  but  not  before  we  really  explore  the  core) • Spring • Struts • Seam • NetBeans • Any  framework  above  and  beyond  Java  EE  6  that  has   significant  overlap  with  Java  EE  6  is  out  of  scope Caucho  Home    |    Contact  Us    |    Caucho  Blog    |    Wiki    |  Applica8on  ServerThursday, May 3, 12
  10. 10. So  far.... • Cook  books  and  Tutorials • Building a simple Listing in JSP: covers model 2, Servlets, JSP intro. • Java EE Servlet tutorial- Adding create, update and delete to the bookstore listing: covers more interactions • Java EE Servlet tutorial: Using JSPs to create header, footer area, formatting and basic CSS for bookstore. • Java EE Servlet tutorial: Adding MySQL and JDBC to bookstore example. Caucho  Home    |    Contact  Us    |    Caucho  Blog    |    Wiki    |  Applica8on  ServerThursday, May 3, 12