SlideShare a Scribd company logo
Boston Computing Review Pragmatic Architectural Overview Java Server Pages John Brunswick
Why?  This is so old school. History and Pains of Web Development Foundation Development Tools Anatomy Nuts and Bolts Over the Horizon
Why?  It is  not  sexy. Presentation Layer for J2EE Nobody owns it It is here and not going anywhere What do non-Microsoft projects get developed with?  Yup. Oracle, BEA, IBM, SAP, EMC, HP… and on and on. Want to code in the enterprise? API heaven Frameworks JSF and others
History Step into the time machine
Common Gateway Interface (CGI) CGI is not a programming language Most CGI programs are written in Perl Issues Scalability Security Debugging Seperation of Presentation and Logic
Classic ASP (3.0) Single platform (MS) Mixed presentation and logic Run time interpretation
Hypertext Preprocessor (PHP) Lacks OO Design Runtime interpretation Mixed presentation and logic
Coldfusion Markup Language (CFM) Depth Scalability Enterprise Interoperability
ASP.NET Platform (MS) Lacks MVC Cost
Emerging Web Application Frameworks ROR Django
Digging In
Foundation Overview JSP is actually servlets! Application / HTTP Server Acronym Overload How do we develop? Application Anatomy 101 JDBC
Servlet  JSP HelloWorld Servlet package org.apache.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static java.util.Vector _jspx_dependants; public java.util.List getDependants() { return _jspx_dependants; } public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { JspFactory _jspxFactory = null; PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType(&quot;text/html&quot;); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write(&quot;<html>\n&quot;); out.write(&quot;  <head>\n&quot;); out.write(&quot;  <title>JSP and Beyond Hello World</title>\n&quot;); out.write(&quot;  </head>\n&quot;); out.write(&quot;  <body>\n&quot;); out.write(&quot;  Hello World  \n&quot;); out.write(&quot;  </body>\n&quot;); out.write(&quot;</html>\n&quot;); } catch (Throwable t) { if (!(t instanceof SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); } } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context); } } } <html> <head> <title>JSP and Beyond Hello World</title> </head> <body> Hello World  </body> </html>
Server Architecture (container)
Application Servers Tomcat Apache who? JBOSS Resin BEA WebLogic WebSphere JRUN… (not so much)
Hmmm… Acronyms Abound JDK J2SE SDK JRE J2EE Java 5 JVM
Start Coding Netbeans Eclipse
Anatomy 101 YourWebApp/ Within this directory all static content should reside.  This includes JSP, HTML and image files.  YourWebApp /WEB-INF/ The Web Application deployment descriptor (web.xml) lives within this directory.  This deployment descriptor maintains all of your application settings that dictate how the container delivers your application.  This directory is private and not externally accessible by end users. YourWebApp /WEB-INF/classes Java classes and servlets should reside in this directory.  This directory is private and not externally accessible by end users. YourWebApp /WEB-INF/lib Place JAR file and tag libraries here.  This directory is private and not externally accessible by end users. FYI…. During application development it is most advantageous to work with your application files in what is called an  exploded  format.  Once the application is ready for distribution it can be packaged into a WAR file for easy portability.
WARs JARs and EARs? WAR One big zip file for an application, no fighting! JAR Zip file with classes EAR Lots of WARs, JARs For Enterprise (not Kirk and Spock)
JSP Dissected
Page Elements
Scriptlet <% … %> Inline Code (yuck) <table> <% String months[] =  {&quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot;, &quot;May&quot;, &quot;Jun&quot;,  &quot;July&quot;, &quot;Aug&quot;, &quot;Sep&quot;, &quot;Oct&quot;, &quot;Nov&quot;, &quot;Dec&quot;}; for(int i = 0; i < months.length; i++ ) { %> <tr> <td>  Month: <%= months[i] %> </td> </tr>  <% } %> </table>
Directives <%@ … %> Directives do not send output to the screen, but set configuration values for the JSP page  Page <%@ page import=&quot;java.util.*, java.lang.*&quot; %>   errorPage / isErrorPage Buffering… etc… Include Directive Taglib Directive http://java.sun.com/products/jsp/syntax/1.2/syntaxref1210.html .
Expression <%= … %> <%@ page import=&quot;java.util.*&quot; %> <%! String sName = &quot;Bill Smith&quot;; %> <table> <tr> <td> Welcome  <%= sName %> ! </td> </tr> </table> Straight to screen output
Decleration <%! … %> Used to set variables and define methods within the JSP <%@ page import=&quot;java.util.*&quot; %> <%! // This is the method that will return the current time String GetCurrentTime() { Date date = new Date(); return date.toString(); } %> <table> <tr> <td> What time is it? <%= GetCurrentTime() %> </td> </tr> </table>
Comment <%-- … --%> With the JSP style comments we can keep comments inline with the code, but they will not be sent to the requestor’s browser.
Programming Elements
Implicit Objects Request Cookies, querystring variables and other pieces of data are readily accessible from the request object. Response Response is used to send information to the client.  A good example might be setting a cookie.  The following block of code send a cookie to the client that can be retrieved at a later time <% response.addCookie(myCookie) %> Session The session object is useful for storing small amounts of information that will be accessible throughout a users visit to your application or web site.  A good example might be their user ID so you will not have to continually query a database to find this information Etc…..
Coffee Time - JavaBeans Provide a simple interface for storing, retrieving information and other complex operations through a very simple XML tag By using this level of integration with JSP JavaBeans can help us to separate the presentation (HTML) from the business logic that the Beans handle Value VS Utility Reuse Reuse
Get and Set (encapsulate) public class OurSampleBean { String sOurTestValue; public OurSampleBean() { } public String getSometValue() { Return someValue; } public void setSomeValue (String sSomeValue) { this.value = sSomeValue; } }
JDBC – Get our DB on // Import the namespace for the database connection import java.sql // Create the database connection object Connection cnDB = null; // Load the driver that will be used for the database connection Class.forName(&quot;com.mysql.jdbc.Driver&quot;).newInstance(); // Establish the connection cnDB = DriverManager.getConnection(&quot;jdbc:mysql:///DatabaseName&quot;,&quot;user&quot;, &quot;password&quot;);
JDBC Cont… // Prepare a statement object that will be used to request the data Statement stmt = cnDB.createStatement();   // Create an object to hold the results set ResultSet results; // Populate the results object with the data from the SQL statement above results = stmt.executeQuery(&quot;SELECT * FROM tblCustomer ORDER BY CustomerName&quot;);
One more for the road // Obtain a statement object Statement stmt = cnDB.createStatement();  // Execute the block of SQL code stmt.executeUpdate(&quot;INSERT INTO tblCustomer VALUES ('Smith', 'Boston', 2006)&quot;); // Close the result set stmt.close(); // Close the connection cnDB.close();
JSTL – Messy but fun Hmmm… CFM anyone? Good for prototyping <c:if test=&quot;${book.orderQuantity > book.inStock}&quot;> The book <c:out value=&quot;${book.title}&quot;/> is currently out of stock. </c:if>
And then some…
And then… Error handling <%@ page errorPage=&quot;CatchError.jsp&quot;%> <%@ page isErrorPage=&quot;true&quot; %> Email Grab a library File upload Use a bean
Next Level MVC and Frameworks JSF, Struts
Thanks for your time!
Ad

More Related Content

What's hot (19)

Jsp 01
Jsp 01Jsp 01
Jsp 01
Subhasis Nayak
 
Jsp1
Jsp1Jsp1
Jsp1
Soham Sengupta
 
Ridingapachecamel
RidingapachecamelRidingapachecamel
Ridingapachecamel
Apache Event Beijing
 
JSP Standart Tag Lİbrary - JSTL
JSP Standart Tag Lİbrary - JSTLJSP Standart Tag Lİbrary - JSTL
JSP Standart Tag Lİbrary - JSTL
seleciii44
 
JSP Standard Tag Library
JSP Standard Tag LibraryJSP Standard Tag Library
JSP Standard Tag Library
Ilio Catallo
 
Ant - Another Neat Tool
Ant - Another Neat ToolAnt - Another Neat Tool
Ant - Another Neat Tool
Kanika2885
 
jQuery Mobile & PhoneGap
jQuery Mobile & PhoneGapjQuery Mobile & PhoneGap
jQuery Mobile & PhoneGap
Swiip
 
Migrating from JSF1 to JSF2
Migrating from JSF1 to JSF2Migrating from JSF1 to JSF2
Migrating from JSF1 to JSF2
tahirraza
 
What's new and exciting with JSF 2.0
What's new and exciting with JSF 2.0What's new and exciting with JSF 2.0
What's new and exciting with JSF 2.0
Michael Fons
 
KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7
phuphax
 
Introduction to Sightly
Introduction to SightlyIntroduction to Sightly
Introduction to Sightly
Ankit Gubrani
 
Ajax Security
Ajax SecurityAjax Security
Ajax Security
Joe Walker
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
ipolevoy
 
Wt unit 2 ppts client side technology
Wt unit 2 ppts client side technologyWt unit 2 ppts client side technology
Wt unit 2 ppts client side technology
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
 
Building Smart Workflows - Dan Diebolt
Building Smart Workflows - Dan DieboltBuilding Smart Workflows - Dan Diebolt
Building Smart Workflows - Dan Diebolt
QuickBase, Inc.
 
Scorware - Spring Introduction
Scorware - Spring IntroductionScorware - Spring Introduction
Scorware - Spring Introduction
vschiavoni
 
jstl ( jsp standard tag library )
jstl ( jsp standard tag library )jstl ( jsp standard tag library )
jstl ( jsp standard tag library )
Adarsh Patel
 
Intro To Hibernate
Intro To HibernateIntro To Hibernate
Intro To Hibernate
Amit Himani
 
Apache Persistence Layers
Apache Persistence LayersApache Persistence Layers
Apache Persistence Layers
Henning Schmiedehausen
 
JSP Standart Tag Lİbrary - JSTL
JSP Standart Tag Lİbrary - JSTLJSP Standart Tag Lİbrary - JSTL
JSP Standart Tag Lİbrary - JSTL
seleciii44
 
JSP Standard Tag Library
JSP Standard Tag LibraryJSP Standard Tag Library
JSP Standard Tag Library
Ilio Catallo
 
Ant - Another Neat Tool
Ant - Another Neat ToolAnt - Another Neat Tool
Ant - Another Neat Tool
Kanika2885
 
jQuery Mobile & PhoneGap
jQuery Mobile & PhoneGapjQuery Mobile & PhoneGap
jQuery Mobile & PhoneGap
Swiip
 
Migrating from JSF1 to JSF2
Migrating from JSF1 to JSF2Migrating from JSF1 to JSF2
Migrating from JSF1 to JSF2
tahirraza
 
What's new and exciting with JSF 2.0
What's new and exciting with JSF 2.0What's new and exciting with JSF 2.0
What's new and exciting with JSF 2.0
Michael Fons
 
KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7KMUTNB - Internet Programming 5/7
KMUTNB - Internet Programming 5/7
phuphax
 
Introduction to Sightly
Introduction to SightlyIntroduction to Sightly
Introduction to Sightly
Ankit Gubrani
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
ipolevoy
 
Building Smart Workflows - Dan Diebolt
Building Smart Workflows - Dan DieboltBuilding Smart Workflows - Dan Diebolt
Building Smart Workflows - Dan Diebolt
QuickBase, Inc.
 
Scorware - Spring Introduction
Scorware - Spring IntroductionScorware - Spring Introduction
Scorware - Spring Introduction
vschiavoni
 
jstl ( jsp standard tag library )
jstl ( jsp standard tag library )jstl ( jsp standard tag library )
jstl ( jsp standard tag library )
Adarsh Patel
 
Intro To Hibernate
Intro To HibernateIntro To Hibernate
Intro To Hibernate
Amit Himani
 

Similar to Boston Computing Review - Java Server Pages (20)

Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
BG Java EE Course
 
สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1
ทวิร พานิชสมบัติ
 
Itemscript, a specification for RESTful JSON integration
Itemscript, a specification for RESTful JSON integrationItemscript, a specification for RESTful JSON integration
Itemscript, a specification for RESTful JSON integration
{item:foo}
 
UNO based ODF Toolkit API
UNO based ODF Toolkit APIUNO based ODF Toolkit API
UNO based ODF Toolkit API
Alexandro Colorado
 
Spring and DWR
Spring and DWRSpring and DWR
Spring and DWR
wiradikusuma
 
Javazone 2010-lift-framework-public
Javazone 2010-lift-framework-publicJavazone 2010-lift-framework-public
Javazone 2010-lift-framework-public
Timothy Perrett
 
Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
Clinton Dreisbach
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
Sagar Nakul
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
Sagar Nakul
 
Struts,Jsp,Servlet
Struts,Jsp,ServletStruts,Jsp,Servlet
Struts,Jsp,Servlet
dasguptahirak
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSF
SoftServe
 
Ta Javaserverside Eran Toch
Ta Javaserverside Eran TochTa Javaserverside Eran Toch
Ta Javaserverside Eran Toch
Adil Jafri
 
Introduction to AJAX and DWR
Introduction to AJAX and DWRIntroduction to AJAX and DWR
Introduction to AJAX and DWR
SweNz FixEd
 
Javascript
JavascriptJavascript
Javascript
mussawir20
 
Resthub lyonjug
Resthub lyonjugResthub lyonjug
Resthub lyonjug
Sébastien Deleuze
 
Apache Aries Blog Sample
Apache Aries Blog SampleApache Aries Blog Sample
Apache Aries Blog Sample
Skills Matter
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
yuvalb
 
Sqladria 2009 SRC
Sqladria 2009 SRCSqladria 2009 SRC
Sqladria 2009 SRC
tepsum
 
Compass Framework
Compass FrameworkCompass Framework
Compass Framework
Lukas Vlcek
 
Real-World AJAX with ASP.NET
Real-World AJAX with ASP.NETReal-World AJAX with ASP.NET
Real-World AJAX with ASP.NET
goodfriday
 
Itemscript, a specification for RESTful JSON integration
Itemscript, a specification for RESTful JSON integrationItemscript, a specification for RESTful JSON integration
Itemscript, a specification for RESTful JSON integration
{item:foo}
 
Javazone 2010-lift-framework-public
Javazone 2010-lift-framework-publicJavazone 2010-lift-framework-public
Javazone 2010-lift-framework-public
Timothy Perrett
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
Sagar Nakul
 
Strutsjspservlet
Strutsjspservlet Strutsjspservlet
Strutsjspservlet
Sagar Nakul
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSF
SoftServe
 
Ta Javaserverside Eran Toch
Ta Javaserverside Eran TochTa Javaserverside Eran Toch
Ta Javaserverside Eran Toch
Adil Jafri
 
Introduction to AJAX and DWR
Introduction to AJAX and DWRIntroduction to AJAX and DWR
Introduction to AJAX and DWR
SweNz FixEd
 
Apache Aries Blog Sample
Apache Aries Blog SampleApache Aries Blog Sample
Apache Aries Blog Sample
Skills Matter
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
yuvalb
 
Sqladria 2009 SRC
Sqladria 2009 SRCSqladria 2009 SRC
Sqladria 2009 SRC
tepsum
 
Compass Framework
Compass FrameworkCompass Framework
Compass Framework
Lukas Vlcek
 
Real-World AJAX with ASP.NET
Real-World AJAX with ASP.NETReal-World AJAX with ASP.NET
Real-World AJAX with ASP.NET
goodfriday
 
Ad

Recently uploaded (20)

Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Ad

Boston Computing Review - Java Server Pages

  • 1. Boston Computing Review Pragmatic Architectural Overview Java Server Pages John Brunswick
  • 2. Why? This is so old school. History and Pains of Web Development Foundation Development Tools Anatomy Nuts and Bolts Over the Horizon
  • 3. Why? It is not sexy. Presentation Layer for J2EE Nobody owns it It is here and not going anywhere What do non-Microsoft projects get developed with? Yup. Oracle, BEA, IBM, SAP, EMC, HP… and on and on. Want to code in the enterprise? API heaven Frameworks JSF and others
  • 4. History Step into the time machine
  • 5. Common Gateway Interface (CGI) CGI is not a programming language Most CGI programs are written in Perl Issues Scalability Security Debugging Seperation of Presentation and Logic
  • 6. Classic ASP (3.0) Single platform (MS) Mixed presentation and logic Run time interpretation
  • 7. Hypertext Preprocessor (PHP) Lacks OO Design Runtime interpretation Mixed presentation and logic
  • 8. Coldfusion Markup Language (CFM) Depth Scalability Enterprise Interoperability
  • 9. ASP.NET Platform (MS) Lacks MVC Cost
  • 10. Emerging Web Application Frameworks ROR Django
  • 12. Foundation Overview JSP is actually servlets! Application / HTTP Server Acronym Overload How do we develop? Application Anatomy 101 JDBC
  • 13. Servlet JSP HelloWorld Servlet package org.apache.jsp; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private static java.util.Vector _jspx_dependants; public java.util.List getDependants() { return _jspx_dependants; } public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { JspFactory _jspxFactory = null; PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType(&quot;text/html&quot;); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write(&quot;<html>\n&quot;); out.write(&quot; <head>\n&quot;); out.write(&quot; <title>JSP and Beyond Hello World</title>\n&quot;); out.write(&quot; </head>\n&quot;); out.write(&quot; <body>\n&quot;); out.write(&quot; Hello World \n&quot;); out.write(&quot; </body>\n&quot;); out.write(&quot;</html>\n&quot;); } catch (Throwable t) { if (!(t instanceof SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); } } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context); } } } <html> <head> <title>JSP and Beyond Hello World</title> </head> <body> Hello World </body> </html>
  • 15. Application Servers Tomcat Apache who? JBOSS Resin BEA WebLogic WebSphere JRUN… (not so much)
  • 16. Hmmm… Acronyms Abound JDK J2SE SDK JRE J2EE Java 5 JVM
  • 18. Anatomy 101 YourWebApp/ Within this directory all static content should reside. This includes JSP, HTML and image files. YourWebApp /WEB-INF/ The Web Application deployment descriptor (web.xml) lives within this directory. This deployment descriptor maintains all of your application settings that dictate how the container delivers your application. This directory is private and not externally accessible by end users. YourWebApp /WEB-INF/classes Java classes and servlets should reside in this directory. This directory is private and not externally accessible by end users. YourWebApp /WEB-INF/lib Place JAR file and tag libraries here. This directory is private and not externally accessible by end users. FYI…. During application development it is most advantageous to work with your application files in what is called an exploded format. Once the application is ready for distribution it can be packaged into a WAR file for easy portability.
  • 19. WARs JARs and EARs? WAR One big zip file for an application, no fighting! JAR Zip file with classes EAR Lots of WARs, JARs For Enterprise (not Kirk and Spock)
  • 22. Scriptlet <% … %> Inline Code (yuck) <table> <% String months[] = {&quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot;, &quot;May&quot;, &quot;Jun&quot;, &quot;July&quot;, &quot;Aug&quot;, &quot;Sep&quot;, &quot;Oct&quot;, &quot;Nov&quot;, &quot;Dec&quot;}; for(int i = 0; i < months.length; i++ ) { %> <tr> <td> Month: <%= months[i] %> </td> </tr> <% } %> </table>
  • 23. Directives <%@ … %> Directives do not send output to the screen, but set configuration values for the JSP page Page <%@ page import=&quot;java.util.*, java.lang.*&quot; %> errorPage / isErrorPage Buffering… etc… Include Directive Taglib Directive http://java.sun.com/products/jsp/syntax/1.2/syntaxref1210.html .
  • 24. Expression <%= … %> <%@ page import=&quot;java.util.*&quot; %> <%! String sName = &quot;Bill Smith&quot;; %> <table> <tr> <td> Welcome <%= sName %> ! </td> </tr> </table> Straight to screen output
  • 25. Decleration <%! … %> Used to set variables and define methods within the JSP <%@ page import=&quot;java.util.*&quot; %> <%! // This is the method that will return the current time String GetCurrentTime() { Date date = new Date(); return date.toString(); } %> <table> <tr> <td> What time is it? <%= GetCurrentTime() %> </td> </tr> </table>
  • 26. Comment <%-- … --%> With the JSP style comments we can keep comments inline with the code, but they will not be sent to the requestor’s browser.
  • 28. Implicit Objects Request Cookies, querystring variables and other pieces of data are readily accessible from the request object. Response Response is used to send information to the client. A good example might be setting a cookie. The following block of code send a cookie to the client that can be retrieved at a later time <% response.addCookie(myCookie) %> Session The session object is useful for storing small amounts of information that will be accessible throughout a users visit to your application or web site. A good example might be their user ID so you will not have to continually query a database to find this information Etc…..
  • 29. Coffee Time - JavaBeans Provide a simple interface for storing, retrieving information and other complex operations through a very simple XML tag By using this level of integration with JSP JavaBeans can help us to separate the presentation (HTML) from the business logic that the Beans handle Value VS Utility Reuse Reuse
  • 30. Get and Set (encapsulate) public class OurSampleBean { String sOurTestValue; public OurSampleBean() { } public String getSometValue() { Return someValue; } public void setSomeValue (String sSomeValue) { this.value = sSomeValue; } }
  • 31. JDBC – Get our DB on // Import the namespace for the database connection import java.sql // Create the database connection object Connection cnDB = null; // Load the driver that will be used for the database connection Class.forName(&quot;com.mysql.jdbc.Driver&quot;).newInstance(); // Establish the connection cnDB = DriverManager.getConnection(&quot;jdbc:mysql:///DatabaseName&quot;,&quot;user&quot;, &quot;password&quot;);
  • 32. JDBC Cont… // Prepare a statement object that will be used to request the data Statement stmt = cnDB.createStatement(); // Create an object to hold the results set ResultSet results; // Populate the results object with the data from the SQL statement above results = stmt.executeQuery(&quot;SELECT * FROM tblCustomer ORDER BY CustomerName&quot;);
  • 33. One more for the road // Obtain a statement object Statement stmt = cnDB.createStatement(); // Execute the block of SQL code stmt.executeUpdate(&quot;INSERT INTO tblCustomer VALUES ('Smith', 'Boston', 2006)&quot;); // Close the result set stmt.close(); // Close the connection cnDB.close();
  • 34. JSTL – Messy but fun Hmmm… CFM anyone? Good for prototyping <c:if test=&quot;${book.orderQuantity > book.inStock}&quot;> The book <c:out value=&quot;${book.title}&quot;/> is currently out of stock. </c:if>
  • 36. And then… Error handling <%@ page errorPage=&quot;CatchError.jsp&quot;%> <%@ page isErrorPage=&quot;true&quot; %> Email Grab a library File upload Use a bean
  • 37. Next Level MVC and Frameworks JSF, Struts