The JavaTM Tutorial

| Start of Tutorial > Start of Trail > Start of Lesson | Search Feedback Form

Trail: Servlets
Lesson: Running Servlets

## Calling Servlets From a Browser

> The URL for a servlet has the following general form, where servlet-name corresponds to the name you have given your servlet:

>         http://machine-name:port/servlet/servlet-name

> For example, the servlet that delivers the main page of Duke's Bookstore has the property `servlet.bookstore.code=BookStoreServlet`. To see the main page of the example, type the following URL into your browser:

>         http://localhost:8080/servlet/bookstore

> Servlet 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:

>         http://localhost:8080/servlet/bookdetails?bookId=203

| Start of Tutorial > Start of Trail > Start of Lesson | Search Feedback Form