Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
XML
XML
borderStylesolid
titleweb.xml
<!--
The deployment descriptor of the web client.
-->
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xmlns="http://java.sun.com/xml/ns/javaee" 
         xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
         http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
         id="WebApp_ID" version="2.5">

  <display-name>ShareHolderWEB</display-name>
   <servlet>
    <description></description>
    <display-name>Test</display-name>
    <servlet-name>Test</servlet-name>
    <servlet-class>sample.jpa.Test</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Test</servlet-name>
    <url-pattern>/Test</url-pattern>
  </servlet-mapping>
</web-app>
Code Block

...

XML
XML
borderStylesolid
titleweb.xml

<!--
The geronimo deployment plan of the web client.
-->

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1" 
         xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2" 
         xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0" 
         xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">
  <sys:environment>
    <sys:moduleId>
      <sys:groupId>JPA</sys:groupId>
      <sys:artifactId>ShareHolderWEB</sys:artifactId>
      <sys:version>1.0</sys:version>
      <sys:type>car</sys:type>
    </sys:moduleId>
  </sys:environment>
  <context-root>/ShareHolderWEB</context-root>
</web-app>

The Servlet client Test.java, looks up the ShareHolderBean and executes various methods on the ShareAccount entity. When the url http://localhost:8080/ShareHolderWEB/TestImage Added is hit on a browser window, the following output is displayed.

No Format
borderStylesolid
titlehttp://localhost:8080/ShareHolderWEB/Test

_________________________________________
Looking up ShareHolderBean
Creating ShareAccount 1, Phani, 10
Account is successfully created
Looking up the ShareAccountNumber 1
Printing the details of ShareAccountNumber 1
Account Number = 1
Owner Name = phani
number of shares 10
version=1
_________________________________________

_________________________________________

buying shares 100
Printing the details of ShareAccountNumber 1
Account Number = 1
Owner Name = phani
number of shares 110
version=2
_________________________________________

_________________________________________
selling 50 shares of ShareAccountNumber 1
Printing the details of ShareAccountNumber 1
Account Number = 1
Owner Name = phani
number of shares 60
version=3
_________________________________________

_________________________________________
Printing all the available accounts
*******
Account Number = 1
Owner Name = phani
number of shares 60
version=3
*******
_________________________________________

_________________________________________
Setting the ShareAccount 1 with 500 shares and updating the database
Printing the details of ShareAccountNumber 1
Account Number = 1
Owner Name = phani
number of shares 500
version=0
_________________________________________

_________________________________________
Closing ShareAccountNumber 1
Printing the details of ShareAccountNumber 1
Account Number = 1
Owner Name = null
number of shares 0
version=0
_________________________________________