Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## example.servlet.basic
Class HelloServlet

    example.servlet.basic.HelloServlet

public class HelloServlet

Introduces servlets with the hello, world example.

Most servlets will extend HttpServlet and implement the doGet method. Servlets which handle POST request will implement the doPost method.

Resin maps the calling URL to the servlet using the <servlet-mapping> configuration in the resin.conf or web.xml.

For example, this servlet is called with the URL /tutorial/servlet/example.servlet.basic.HelloServlet. That mapping is configured in the doc/tutorial/WEB-INF/web.xml with the special "invoker" servlet: ``

     <servlet-mapping>
       <url-pattern>/servlet/*</url-pattern>
       <servlet-name>invoker</servlet-name>
     </servlet-mapping>

Every URL matching /servlet/* will use the invoker. The invoker finds the classname "example.servlet.basic.HelloServlet" following the /servlet, instantiates it and sends it the request.

This servlet belongs in WEB-INF/classes/example/servlet/basic/HelloServlet.java. In the standard Resin installation, it will be something like resin-2.0.2/doc/java_tut/WEB-INF/...

When the servlet .java file is changed, Resin will automatically recompile it. It's a good idea to go to the HelloServlet.java and modify it (change the string to "Hi, World"), to get the basic idea.

Constructor Summary
`HelloServlet()`

Method Summary
`void` | `doGet(example.servlet.basic.HttpServletRequest request, example.servlet.basic.HttpServletResponse response)` Handles GET requests.

Constructor Detail

### HelloServlet

    public HelloServlet()

Method Detail

### doGet

    public void doGet(example.servlet.basic.HttpServletRequest request,
                      example.servlet.basic.HttpServletResponse response)
               throws java.io.IOException,
                      example.servlet.basic.ServletException

  Handles GET requests. Resin will call the doGet method when the browser sends a GET request.
  Parameters:
    `request` - the request object contains the data from the browser's request.
    `response` - the response object contains methods to send data back to the browser.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD