Running the Application


To run the application, first we need to know what the URL is to access the application. You can figure this out by looking at the web.xml and build.xml files. The path to use in the URL is based on the WAR file's name and the url-pattern from the servlet-mapping section in the web.xmlfile. In our case the WAR file is named quote.war and the servlet mapping is quote. This gives us the path /quote/quote, which we put together with the host and port portion of a URL.

How do I do that?

Open your web browser and go to http://localhost:8080/quote/quote. You should see something like Figure 2-3.

Leave the web browser open, as you'll probably want to use it in the next lab. You might want to click the browser's refresh button to see the counts on the page go up. After you've done that a few times, do another build. Once that build is done and deployed, click the browser's refresh button a few more times. Now you should see that the counts are different (see Figure 2-4). The application count gets reset each time the servlet is reloaded, which happens whenever you deploy the application. However, the session state doesn't get reset. So, the server is maintaining state; and you're not losing it when you do a redeploy. Hot deploy makes this possible.

Developer's Notebook 2-3. Einstein quote server


Developer's Notebook 2-4. Count changes


What just happened?

When you went to the URL for the application, the application compiled and created a servlet based on what is specified in the servlet section of the web.xml file. Then JBoss deployed that servlet and created a mapping based on the servlet-mapping section of the web.xmlfile. Again, the URL is based on the WAR filename created by the build (look in build.xml) and the URL pattern mapping in the web.xml file.

You also got to see hot deploy in action. Plus, you got a few tidbits of advice from the great Einstein himself.



JBoss. A Developer's Notebook
JBoss: A Developers Notebook
ISBN: 0596100078
EAN: 2147483647
Year: 2003
Pages: 106

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net