CIS 550CSE 330 Project tutorial - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

CIS 550CSE 330 Project tutorial

Description:

Web 2.0 sites and tools. Facebook, Digg, Blogspot, Flickr, ... Project: News sharing... Allow users to share popular worldwide news at any moment. ... – PowerPoint PPT presentation

Number of Views:98
Avg rating:3.0/5.0
Slides: 18
Provided by: Mar49
Category:

less

Transcript and Presenter's Notes

Title: CIS 550CSE 330 Project tutorial


1
CIS 550/CSE 330 Project tutorial
  • Fall 2008

2
Project Motivation
  • Web 2.0 sites and tools
  • Facebook, Digg, Blogspot, Flickr,

3
Project News sharing
  • Allow users to share popular worldwide news at
    any moment.
  • Basic unit of news a hyperlink, pointing to
    an article, story, image or video.
  • Allow users to vote, comment and discuss on
    potential topics.

4
Basic functionality requirements
  • Registered User Base
  • Hyperlink lists
  • Friend lists
  • Voting, comments
  • Keyword search
  • XML feeds
  • Crawler
  • Recommendation system
  • Basic GUI, at the least!

Additional features are welcome and encouraged,
possibly for extra credit!
5
Languages
  • With TA tech support
  • Java (strongly recommended)
  • Without TA tech support
  • Python
  • C, C
  • .NET

6
Languages (contd)
  • Other frameworks Ruby on rails, Django, PHP
  • -- No object-relational mapping will be allowed.
  • -- You must write SQL queries and definition
    statements and XML generating code on your own!
  • For any other language, please talk to
    profs/TAs.

7
Some equipment youll need
  • IDE Eclipse, NetBeans
  • DBMS Oracle, MySQL
  • Servlet containers Tomcat or Jetty
  • Recommended tools
  • Version Control Subversion
  • Presentation JSP, Struts

8
Tutorial on Java Servlets
  • Better alternative to CGI
  • Main difference multiple processes vs. multiple
    threads
  • Basic architecture

Servlet container
REQ
DBMS
Servlet
Browser
RESP
9
Servlet containers
  • Servlet containers act as a web server plus an
    execution environment for java code.
  • Examples Apache Tomcat and Jetty
  • Tomcat on SEAS documentation to be provided.
  • Test on your own machine first!

10
Jetty
  • A simple servlet container and web server written
    in Java.
  • To start java jar start.jar
  • Web applications go in the webapps directory.
  • webapps/hello maps to http//localhost8080/hello
  • Jetty listens on port 8080 by default.

11
Forms
  • Forms allow the user to submit data to the
    servlet

12
The Servlet API
  • Two required functions for handling requests
  • public void doGet(HttpServletRequest req,
  • HttpServletResponse resp)
  • public void doPost(HttpServletRequest req,
  • HttpServletResponse resp)
  • Req contains information about the client and the
    request.
  • Resp gives you access to the output stream.
  • http//java.sun.com/products/servlet/2.3/javadoc/

13
Compiling a Servlet
  • Servlet class files go in WEB-INF/classes.
  • Servlet API classes are provided by Jetty
  • JETTY_ROOT/lib/servlet-api-2.5-6.1.11.jar
  • To compile
  • javac -cp JETTY_ROOT/lib/servlet-api-2.5-6.1.11.j
    ar.
  • HelloServlet.java
  • For Oracle, we also need ojdbc14.jar in the
    libraries directory and the classpath.

14
web.xml
  • Defines the mapping between URLs and the servlet
    class that handles requests.
  • Example
  • HelloServlet
  • HelloServlet
  • HelloServlet
  • /servlet

15
Java Server Pages (JSP)
  • Allow embedding Java in HTML.
  • Good for defining data presentation.
  • Struts (not shown here) is a framework for
    combining servlets and JSP pages.
  • Application logic handled by Servlet.
  • Presentation generated by JSP.

16
Managing Sessions
  • HttpSession object provided by the servlet
    container.
  • Associates arbitrary data with the user session.
  • Managed internally with cookies.
  • req.getSession() or req.getSession(boolean)

17
Questions?
Write a Comment
User Comments (0)
About PowerShow.com