1 Web Search Interfaces. 2 Web Search Interface Web search engines of course need a web-based interface. Search page must accept a query string and submit.

Slides:



Advertisements
Similar presentations
Chapter 6 Server-side Programming: Java Servlets
Advertisements

Internet i jego zastosowania 1 J2EE Servlets. Internet i jego zastosowania 2 Agenda Overview Servlet Interface Servlet Context Request Response Sample.
Servlets. Servlets are modules that extend Java-enabled web servers. For example, a servlet might be responsible for taking data in an HTML order-entry.
J0 1 Marco Ronchetti - Basi di Dati Web e Distribuite – Laurea Specialitica in Informatica – Università di Trento.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 10 Servlets and Java Server Pages.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 9 Using Perl for CGI Programming.
7 Copyright © 2005, Oracle. All rights reserved. Maintaining State in J2EE Applications.
4 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: Servlets.
6 Copyright © 2005, Oracle. All rights reserved. Using Advanced Techniques in Servlets.
An introduction to Java Servlet
CGI programming. Common Gateway Interface interface between web server and other programs (cgi scripts) information passed as environment variables passed.
Servlets, JSP and JavaBeans Joshua Scotton.  Getting Started  Servlets  JSP  JavaBeans  MVC  Conclusion.
Cookie in a servlet. Cookies are small bits of textual information that a Web server sends to a browser and that the browser returns unchanged when visiting.
1 Servlets Based on Notes by Dave Hollinger & Ethan Cerami Also, the Online Java Tutorial by Sun.
Apache Tomcat as a container for Servlets and JSP
Java Server Pages (JSP)
Java Servlets Java Server Pages (JSP)
JSP1 Java Server Pages (JSP) Introducing JavaServer Pages TM (JSP TM ) JSP scripting elements.
 2002 Prentice Hall. All rights reserved. Chapter 9: Servlets Outline 9.1 Introduction 9.2 Servlet Overview and Architecture Interface Servlet and.
Objectives Ch. D - 1 At the end of this chapter students will: Know the general architecture and purpose of servlets Understand how to create a basic servlet.
Servlets and a little bit of Web Services Russell Beale.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 34 Servlets.
1 Web Search Interfaces. 2 Web Search Interface Web search engines of course need a web-based interface. Search page must accept a query string and submit.
Comp2513 Java Servlet Basics Daniel L. Silver, Ph.D.
Servlets Compiled by Dr. Billy B. L. Lim. Servlets Servlets are Java programs which are invoked to service client requests on a Web server. Servlets extend.
Servlets. Our Project 3-tier application Develop our own multi-threaded server Socket level communication.
Michael Brockway Application Integration Servlets l Introduction & Overview l HTTP Servlets l HTTP get Requests l HTTP post Requests l Multi-tier Applications.
SE-2840 Dr. Mark L. Hornick1 Java Servlet-based web apps Servlet Architecture.
Chapter 10 Servlets and Java Server Pages. A servlet is a Java class designed to be run in the context of a special servlet container An instance of the.
Java Servlets. What Are Servlets? Basically, a java program that runs on the server Basically, a java program that runs on the server Creates dynamic.
Java Server Pages B.Ramamurthy. Topics for Discussion 8/20/20152 Inheritance and Polymorphism Develop an example for inheritance and polymorphism JSP.
Servlets Pranav Maydeo. What is a Servlet ? Servlets are modules of Java code that run in a server application to answer client requests. Servlets are.
Servlets. - Java technology for Common Gateway Interface (CGI) programming. - It is a Java class that dynamically extends the function of a web server.
Java support for WWW Babak Esfandiari (sources: Qusay Mahmoud, Roger Impey, textbook)
Chapter 5 Java Servlets. Objectives Explain the nature of a servlet and its operation Use the appropriate servlet methods in a web application Code the.
J2EE training: 1 Course Material Usage Rules PowerPoint slides for use only in full-semester, for-credit courses at degree-granting.
Web Server Programming 1. Nuts and Bolts. Premises of Course Provides general introduction, no in-depth training Assumes some HTML knowledge Assumes some.
Chapter 3 Servlet Basics. 1.Recall the Servlet Role 2.Basic Servlet Structure 3.A simple servlet that generates plain text 4.A servlet that generates.
Session tracking There are a number of problems that arise from the fact that HTTP is a "stateless" protocol. In particular, when you are doing on- line.
Web Application Development * These slides have been adapted and modified from CoreServlets course material (Marty Hall) and LUMS cs391 (Umair Javed).
Chapter 6 Server-side Programming: Java Servlets
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Session Management.
20-Nov-15introServlets.ppt Intro to servlets. 20-Nov-15introServlets.ppt typical web page – source Hello Hello.
Introduction to Server-Side Web Development Introduction to Server-Side Web Development Session II: Introduction to Server-Side Web Development with Servlets.
1 Java Servlets l Servlets : programs that run within the context of a server, analogous to applets that run within the context of a browser. l Used to.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, Responds oriented other.
1 Introduction to Servlets. Topics Web Applications and the Java Server. HTTP protocol. Servlets 2.
JS (Java Servlets). Internet evolution [1] The internet Internet started of as a static content dispersal and delivery mechanism, where files residing.
©SoftMooreSlide 1 Session Tracking with Servlets.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 21 Java Servlets Wed. 11/22/00 based on material.
Java Servlets and Java Server Pages
Session Tracking Parts of this presentation was provided by SSE.
How CGI and Java Servlets are Run By David Stein 14 November 2006.
Bayu Priyambadha, S.Kom. Static content  Web Server delivers contents of a file (html) 1. Browser sends request to Web Server 3. Web Server sends HTML.
8-Mar-16 More About Servlets Session Tracking. Persistent information A server site typically needs to maintain two kinds of persistent (remembered) information:
S ERVLETS Form Data 19-Mar-16. F ORM P ROCESSING You must have come across many situations when you need to pass some information from your browser to.
Java Servlets References: Karen Anewalt, Mary Washington College.
Servlets.
Servlet Fudamentals.
Java Servlets By: Tejashri Udavant..
Sessions Many interactive Web sites spread user data entry out over several pages: Ex: add items to cart, enter shipping information, enter billing information.
Chapter 6 Server-side Programming: Java Servlets
Pre-assessment Questions
Sessions.
Chapter 26 Servlets.
Servlets and Java Server Pages
Servlet APIs Every servlet must implement javax.servlet.Servlet interface Most servlets implement the interface by extending one of these classes javax.servlet.GenericServlet.
Sessions Many interactive Web sites spread user data entry out over several pages: Ex: add items to cart, enter shipping information, enter billing information.
Web Search Interfaces.
Web Search Interfaces by Ray Mooney
Presentation transcript:

1 Web Search Interfaces

2 Web Search Interface Web search engines of course need a web-based interface. Search page must accept a query string and submit it within an HTML. Program on the server must process requests and generate HTML text for the top ranked documents with pointers to the original and/or cached web pages. Server program must also allow for requests for more relevant documents for a previous query.

3 Submit Forms HTML supports various types of program input in forms, including: –Text boxes –Menus –Check boxes –Radio buttons When user submits a form, string values for various parameters are sent to the server program for processing. Server program uses these values to compute an appropriate HTML response page.

4 Simple Search Submit Form Enter your query: Search Database: UT CS Faculty Yahoo Science Use Relevance Feedback:

5 What’s a Servlet? Java’s answer to CGI programming for processing web form requests. Program runs on Web server and builds pages on the fly. When would you use servlets? –Page is based on user-submitted data e.g search engines. –Data changes frequently e.g. weather-reports. –Page uses information from a databases e.g. on-line stores. Requires running a web server that supports servlets.

6 Basic Servlet Structure import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class SomeServlet extends HttpServlet { // Handle get request public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // request – access incoming HTTP headers and HTML form data // response - specify the HTTP response line and headers // (e.g. specifying the content type, setting cookies). PrintWriter out = response.getWriter(); //out - send content to browser }

7 A Simple Servlet import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloWorld extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); out.println("Hello World"); }

8 Running the Servlet Run servlet using: e.g. …/servlet/package_name.class_name Restart the server if you recompile. –Class is loaded the first time servlet is accessed and remains resident until server is restarted.

9 Generating HTML public class HelloWWW extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println(" \n" + " HelloWWW \n" + " \n" + " Hello WWW \n" + " "); }

10 HTML Post Form <FORM ACTION=“/servlet/hall.ThreeParams” METHOD=“POST”> First Parameter: Second Parameter: Third Parameter:

11 Reading Parameters public class ThreeParams extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println(… +" \n" + " param1: " + request.getParameter("param1") + "\n" + " param2: " + request.getParameter("param2") + "\n" + " param3: " + request.getParameter("param3") + "\n" + " \n" + …); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); }

12 Form Example

13 Servlet Output

14 Reading All Parameters List of all parameter names that have values: Enumeration paramNames = request.getParameterNames(); –Parameter names in unspecified order. Parameters can have multiple values : String[] paramVals = request.getParameterValues(paramName); –Array of param values associated with paramName.

15 Session Tracking Typical scenario – shopping cart in online store. Necessary because HTTP is a "stateless" protocol. Common solutions: Cookies and URL-rewriting. Session Tracking API allows you to: –Look up session object associated with current request. –Create a new session object when necessary. –Look up information associated with a session. –Store information in a session. –Discard completed or abandoned sessions.

16 Session Tracking API - I Looking up a session object: –HttpSession session = request.getSession(true); –Pass true to create a new session if one does not exist. Associating information with session: –session.setAttribute(“user”, request.getParameter(“name”)) –Session attributes can be of any type. Looking up session information: –String name = (String) session.getAttribute(“user”)

17 Session Tracking API - II getId –The unique identifier generated for the session. isNew –true if the client (browser) has never seen the session. getCreationTime –Time in milliseconds since session was made. getLastAccessedTime –Time in milliseconds since the session was last sent from client. getMaxInactiveInterval –# of seconds session should go without access before being invalidated. –Negative value indicates that session should never timeout.

18 Simple Search Servlet Based on directory parameter, creates or selects existing InvertedIndex for the appropriate corpus. Processes the query with VSR to get ranked results. Writes out HTML ordered list of 10 results starting at the rank of the start parameter. Each item includes: –Link to the original URL saved by the spider in the top of the document in BASE tag. –Name link with page extracted from file. –Additional link to local cached file. If all retrievals not already shown, creates a submit form for “ More Results ” starting from the next ranked item.

19 Simple Search Interface Refinements For “ More results ” requests, stores current ranked list with the user session and displays next set in the list. Integrates relevance feedback interaction with “radio buttons” for “ NEUTRAL,” “ GOOD,” and “ BAD ” in HTML form. Could provide “ Get similar pages ” request for each retrieved document (as in Google).Google –Just use given document text as a query.

20 Other Search Interface Refinements Highlight search terms in the displayed document. –Provided in cached file on Google.Google Allow for “advanced” search: –Phrasal search (“..”) –Mandatory terms (+) –Negated term (-) –Language preference –Reverse link –Date preference Machine translation of pages.

21 Clustering Results Group search results into coherent “clusters”: –“microwave dish” One group of on food recipes or cookware. Another group on satellite TV reception. –“Austin bats” One group on the local flying mammals. One group on the local hockey team. Northern Light groups results into “folders” based on a pre-established categorization of pages (like Yahoo or DMOZ categories).Northern Light Alternative is to dynamically cluster search results into groups of similar documents.

22 User Behavior Users tend to enter short queries. –Study in 1998 gave average length of 2.35 words. Users tend not to use advance search options. Users need to be instructed on using more sophisticated queries.