コントローラー Bean からフォーム バッキング Bean データにアクセスしようとしています。フォームからの値は Bean に設定されますが、コントローラー Bean からそれにアクセスしようとすると、値が null になります。null 値は createTicket メソッドにあります:---> ticketData.getSummary());
/*from data bean everything sets here*/
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@SuppressWarnings("PMD")
@ManagedBean(name = "createTicketModelData")
@SessionScoped
public class CreateTicketModelData implements CreateTicketData, Serializable {
private static final long serialVersionUID = 1L;
protected String incidentType;
private TicketId ticketId;
protected UserId receiverId;
protected String summary;
private String description;
private String asset;
private Date dateTime;
protected Date reported;
private Date dateChangeNeeded;
private String priority;
protected List<Attachment> attachments;
public void setAttachments(final List<Attachment> attachments) {
this.attachments = attachments;
}
protected String orgUnit;
protected String location;
protected String costCenter;
private Type type = Type.INCIDENT;
private String severity;
@Override
public String getAsset() {
return asset;
}
@Override
public List<Attachment> getAttachments() {
return attachments;
}
public String getCostCenter() {
return costCenter;
}
.....//getter seters
----------------------------------------------------------------------
/*this is the controller bean where i am not able to get the form data values*/
@ManagedBean(name = "createTicketBaseBean")
@SessionScoped
public class CreateTicketBaseBean implements Serializable {
private static final long serialVersionUID = 1L;
private static final transient Logger LOGGER = LoggerFactory.getLogger(CreateTicketBaseBean.class);
@ManagedProperty(value = "#{ticketData}")
private transient CreateTicketModelData ticketData;
@ManagedProperty(value = "#{ticketingService}")
transient TicketingService dispatcher;
@PostConstruct
protected void init() {
this.workplaceBean = JSFUtils.findBean("selectWorkplaceComponentBean");
this.selectUserBean = JSFUtils.findBean("selectUserBean");
}
public void createTicket(final ActionEvent event) {
Response response = null;
System.out.println("ticket summary------------" + ticketData.getSummary());
setTicketData();
LOGGER.info("Incident type in ticketdatabean---->" + incidentType);
try {
response = dispatcher.createTicket(ticketData);
} catch (Exception e) {
LOGGER.error(e);
FacesMessageUtil.addGlobalUnexpectedErrorMessage();
}
LOGGER.info("Response is---->" + response.getTicketId());
ticketId = response.getTicketId();
}