Java Reference
In-Depth Information
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.
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
public class JmsMessageModel {
private String msgText;
public String getMsgText() {
return msgText;
}
public void setMsgText(String msgText) {
this.msgText = msgText;
}
}
We now turn our attention to the controller, which will actually send the JMS
message to the queue we created in the previous section. Using the NetBeans wizard,
let's create a new Java class named JmsMesageController and annotate it with the
@Named and @RequestScoped annotations.
 
Search WWH ::




Custom Search