1 / 13

CSE 403: Servlet Technology

CSE 403: Servlet Technology. Zach Crisman ( zcrisman@cs ) Shane Cantrel (shanec@cs) 4/10/03. Separate Process for each connection No Standard Libraries/Languages State not saved between connections. One Serlvet Engine Process Java Libraries/Language State saved until servlet destroyed.

braxton
Download Presentation

CSE 403: Servlet Technology

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSE 403: Servlet Technology Zach Crisman (zcrisman@cs) Shane Cantrel (shanec@cs) 4/10/03 CSE 403

  2. Separate Process for each connection No Standard Libraries/Languages State not saved between connections One Serlvet Engine Process Java Libraries/Language State saved until servlet destroyed CGI (Common Gateway Interface) vs Servlets CSE 403

  3. Tomcat & How We Will Be Using it • Official Reference Implementation of Java Servlet Technology • A Servlet Engine & Normal Webserver • Everyone will be running an different instance of Tomcat on a different port numbers (‘81’+instance number) • Will install war (Web Application Resource) files via Tomcat management tasks in Ant CSE 403

  4. Where do I find this stuff? /*For generic , protocol independent servlet functionality*/ import javax.servlet.*; /*For servlets that will use the http protocol (WWW Based)*/ import javax.servlet.http.*; Tutorial @ http://java.sun.com/webservices/docs/1.0/tutorial/doc/Servlets.html API @ http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/package-summary.html Tomcat: Kick Start by Bond & LawFocus on Chapters 1,3,4,6 for this assignment (Don’t worry about JPS stuff) CSE 403

  5. GenericServlet • Protocol Independent • Override service()when extended • Must write one’s own means of handling requests Image from Java Servlet Programming by Jason Hunter CSE 403

  6. HttpServlet • Extends GenericServlet() • Overide doGet(…) & doPost(…) • Already understands http • Majority of servlets extend Image from Java Servlet Programming by Jason Hunter CSE 403

  7. HttpServlet Skeleton import javax.servlet.*; import javax.servlet.http.*; public class ServletSkeleton extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {} public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {} } CSE 403

  8. GET retrieving information html/images parameters listed in URL POST send information uploads/forms parameters hidden within header GET vs POST CSE 403

  9. Servlet Lifecycle • Timing of Lifecycle not specified by serlvet spec • Servlet may be destroyed/ instantiated when you least expect it init() only called once in lifecycle • Multi-threaded environment • destory() should not only free resources but also save state that will be required in another instance • A servlet is only a instance of a class that is dynamically loaded into the servlet engine (Tomcat) CSE 403

  10. Database Info • PostgreSQL 7.3 installed on rockhopper & adeliehttp://www.postgresql.org/docs/ • JDBC interface will be installed • Tomcat: Kick Start, ch 9 (general using databases w/ Tomcat) • Everyone will have accounts already setup on the DB system • w/ database concurrency is not a problem when storing data CSE 403

  11. Web Setup • MIME Settings • .jad • text/vnd.sun.j2me.app-descriptor • .jar • application/java-archive • The settings are preset on Tomcat, but not on other servers. • http://hydrus.net/midlets CSE 403

  12. Downloading the Midlet CSE 403

  13. Running the Midlet Notice unpredictable errors CSE 403

More Related