In this section, we will develop a simple JSF application. One of the CDI managed beans in our application will produce a JMS message and send it to the queue we configured in the previous section.
Let's create a new Java class named JmsMessageModel
. This class will store the message text that will be sent to the queue.
We should then annotate the class with the @Named
annotation to make the class a CDI named bean. We should also annotate the class with the @RequestScoped
annotation to give it a scope of request.
We should add a private variable named msgText
of type String, along with its corresponding getter and setter methods.
Tip
Generating getter and setter methods
Getter and setter methods can be automatically generated by pressing Alt + Insert, and then selecting Getter and Setter
When finished, our class should look like this:
package com.ensode.jmsintro; import javax.enterprise.context.RequestScoped; import javax.inject.Named; @Named @RequestScoped...