Web development with Java Server Pages (JSP) and Servlets - PowerPoint PPT Presentation

1 / 6
About This Presentation
Title:

Web development with Java Server Pages (JSP) and Servlets

Description:

Web development with Java Server Pages (JSP) and Servlets Julien Thibault / Phil Brewster / Kristina Doing-Harris Julien.thibault_at_utah.edu – PowerPoint PPT presentation

Number of Views:135
Avg rating:3.0/5.0
Slides: 7
Provided by: Juli3435
Category:

less

Transcript and Presenter's Notes

Title: Web development with Java Server Pages (JSP) and Servlets


1
Web developmentwith Java Server Pages (JSP) and
Servlets
  • Julien Thibault / Phil Brewster / Kristina
    Doing-Harris
  • Julien.thibault_at_utah.edu

2
Web development
  • Web development includes
  • web design, web content development, client
    liaison, client-side/server-side scripting, web
    server and network security configuration,
    e-commerce
  • Limitations of static HTML
  • HTML only structures data (text, pictures, media)
    for rendering in the browser
  • The hosting web server just send the HTML file as
    is to the user
  • Does not natively offers ways to interface with
    data sources (e.g. Databases)
  • Dynamic web through server-side code
  • A web server dynamically generates a web page
    based on the user request
  • The users request is processed on the
    server-side, and HTML is generated accordingly to
    represent the response, then finally sent back to
    the user.
  • Many technologies and languages available
  • Microsoft .NET, Java Server Pages
  • CGI, PHP, ColdFusion

3
Java Server Pages and Servlets
  • Java Servlets
  • Java Classes used to process HTTP requests
  • Hosted by the web server (typically Apache
    Tomcat)
  • Good technology choice if you want to reuse
    existing Java libraries
  • Java Server Pages (JSP)
  • Java technology used to embed server-side code
    directly into the web page
  • When the JSP pages are deployed, the server
    compiles them and creates the corresponding
    Servlets.
  • JSP example
  • Server-side code is surrounded by the lt and gt
    tags

lthtmlgt ltheadgtHello world testlt/headgt ltbodygt
Hello World! lt new java.util.Date() gt
lt/bodygt lt/htmlgt
4
Using JSP in Eclipse JEE
  • Open Eclipse JEE and create a new Dynamic Web
    Project (e.g. helloproject)
  • The project should include the following folders
  • Java Resources/src/ where you put your Java
    classes (including servlets)
  • WebContent/ where you put your web pages
    (html/jsp), and other web content (pictures, CSS)
  • WebContent/WEB-INF/lib where you put your Java
    libraries (jar files)
  • To create a new JSP page
  • Right-click on WebContent/ -gt New -gt JSP file
    (e.g. create hello.jsp from previous slide)
  • To create a new Servlet
  • Right-click on JavaResources/src/ folder -gt New
    -gt Servlet
  • To deploy your web application
  • Right-click on the project folder -gt Export -gt
    WAR file
  • Destination the webapps/ folder of your Apache
    Tomcat install (e.g. C\Program Files\Apache
    Software Foundation\Tomcat 5.5\webapps\)
  • The project will be packaged into a WAR file (Web
    application ARchive) and deployed onto the server
  • Now you should be able to access you web app at
    http//localhost8080/helloproject/hello.jsp

5
Use CHPC to host your JSP page
  • Connecting to CHPC
  • Host sanddunearch.chpc.utah.edu
  • Login uNID
  • Password uNID password
  • Hosting your JSP pages
  • 1. Create a public_jsp folder in your home
    directory
  • 2. Copy your web page to that folder (scp command
    or WinSCP)
  • 3. Now you can access your webpage at
  • http//webapps.chpc.utah.edu/uNID/page_name
  • Ex http//webapps.chpc.utah.edu/u0668260/index.j
    sp
  • Note if you just copy the WAR file to that
    folder, it might take a few minutes to actually
    deploy.

6
JSP tutorials
Write a Comment
User Comments (0)
About PowerShow.com