Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
The URL for a servlet has the following general forms depending on which server you are using. Context-root corresponds to the subdirectory of
TOMCAT_HOME/webapps
where you have installed your application. Servlet-name corresponds to the name you have given your servlet:
(Tomcat) http://machine-name:port/Context-root/Servlet-name (JSDK) http://machine-name:port/servlet/Servlet-nameFor example, to see the main page of the bookstore example, type the following URL into your browser:
(Tomcat) http://localhost:8080/bookstore/enter (JSDK) http://localhost:8080/servlet/bookstoreServlet URLs can contain queries, such as for HTTP GET requests. For example, the servlet that delivers details about a particuar book takes the stock-number of the book as a query. The servlet's name is
bookdetails
; the URL for the servlet to GET and display all the information about the bookstore's featured book is:
(Tomcat) http://localhost:8080/bookstore/bookdetails?bookId=203 (JSDK) http://localhost:8080/servlet/bookdetails?bookId=203
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Copyright 1995-2002 Sun Microsystems, Inc. All rights reserved.