...
This sample illustrates direct use of JDBC connections from a servlet. For details on outbound connection support see Connectors and Transaction Management (JDBC, JMS, J2CA, DataSource, Connection Pool, EIS). Generally direct use of JDBC is not advised unless you have performance constraints or need for dynamic jdbc (such as in a database browser) that make the use of JPA impractical.
...
- org.apache.geronimo.samples.inventory
- Item - represents Item in the Inventory.
- org.apache.geronimo.samples.inventory.services
- InventoryManager - represents list of services offered by the inventory.
- org.apache.geronimo.samples.inventory.dao
- ItemDAO - contains all database access methods.
- org.apache.geronimo.samples.inventory.exception
- DuplicateItemIdException - custom exception to handle duplication item id scenario.
- ItemException - wraps data access exceptions (NamingException, SQLException).
- NotSufficientQuantityException - Custom exception to handle not sufficient quantity situation.
- org.apache.geronimo.samples.inventory.web
- AddItemServlet - dispatch add item information to service layer.
- IssueingServlet - dispatch issuing items information to service layer.
- RecievingServlet ReceivingServlet - dispatch receiving items information to service layer.
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> <servlet> <display-name>AddItemServlet</display-name> <servlet-name>AddItemServlet</servlet-name> <servlet-class>org.apache.geronimo.samples.inventory.web.AddItemServlet</servlet-class> </servlet> <servlet> <display-name>IssueingServlet</display-name> <servlet-name>IssueingServlet</servlet-name> <servlet-class>org.apache.geronimo.samples.inventory.web.IssueingServlet</servlet-class> </servlet> <servlet> <display-name>RecievingServlet<name>ReceivingServlet</display-name> <servlet-name>ReceivingServlet</servlet-name> <servlet-class>org.apache.geronimo.samples.inventory.web.ReceivingServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>AddItemServlet</servlet-name> <url-pattern>/add_item</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>IssueingServlet</servlet-name> <url-pattern>/issue</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>ReceivingServlet</servlet-name> <url-pattern>/recv</url-pattern> </servlet-mapping> <!-- reference name exposed as a datasource --> <resource-ref> <res-ref-name>jdbc/InventoryDS</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope> </resource-ref> </web-app> |
...
To test the sample application, open a browser and type http://localhost:8080/inventory. The Welcome page of Inventory application which is acts as a notice board will be loaded.
...