Creating a simple session EJB
In this recipe, we will create a simple session bean that returns either a formal or an informal salutation based on a string parameter. In the next recipe we will see how to invoke this EJB from a servlet.
Specifically we will create a stateless session bean. A stateless session bean does not remember its previous invocations. A user will call the bean and the bean will return a result. A stateless bean is not good for maintaining the state of an interactive session such as required to maintain a list of purchases. However, it is useful for one-time calculations. Our bean returns one of two simple greetings.
The creation of a session EJB consists of two steps:
- Create the EJB class annotated with a session ...