Servlets are the pure Java solution to handle web requests. Experienced JSP programmers use servlets in conjunction with JSP to create clearer and simpler applications. The servlets handle Java processing: form handing, calculation and database queries. JSP formats the results. Servlets belong in . On this machine, you'll put the Java source in . Create the following servlet in with your favorite text editor: notepad, emacs, vi, or whatever. (On this machine, )
Now browse the servlet at http://www.jfrn.gov.br:83/java_tut/servlet/test.HelloWorld. Resin will automatically compiles the servlet for you. Browsing servlets differs from page browsing because you're executing a servlet class, not looking at a page. The URL tells Resin to look for a servlet. Resin automatically reloads and recompiles servlets, beans, and classes placed in WEB-INF/classes. You should make some changes and add errors to become familiar with Resin's error reporting. ConfigurationFor development, using the invoker is convenient. Its configuration in the resin.conf looks like
When deploying a web site, it's a good idea to disable the servlet invoker for security reasons. You can configure Resin to invoke your servlet directly. The following example will call the HelloWorld servlet using just the url. For many servlet you'll also want to configure init parameters. In the hello example, you can set the parameter as follows:
|