jsf-spring-integration - chaning the logger
This commit is contained in:
@@ -1,31 +1,25 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.baeldung.springintegration.controllers;
|
||||
|
||||
import com.baeldung.springintegration.dao.IUserManagementDAO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.faces.bean.ManagedBean;
|
||||
import javax.faces.bean.ManagedProperty;
|
||||
import javax.faces.bean.ViewScoped;
|
||||
import javax.faces.context.FacesContext;
|
||||
import java.io.Serializable;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Tayo
|
||||
*/
|
||||
|
||||
@ManagedBean(name = "registration")
|
||||
@ViewScoped
|
||||
public class RegistrationBean implements Serializable {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RegistrationBean.class);
|
||||
|
||||
@ManagedProperty(value = "#{userManagementDAO}")
|
||||
transient private IUserManagementDAO theUserDao;
|
||||
private String userName;
|
||||
private String operationMessage;
|
||||
private boolean operationStatus;
|
||||
|
||||
/**
|
||||
* Creates a new instance of RegistrationBean
|
||||
@@ -35,35 +29,24 @@ public class RegistrationBean implements Serializable {
|
||||
|
||||
public String createNewUser() {
|
||||
try {
|
||||
Logger.getAnonymousLogger().info("Creating new user");
|
||||
LOGGER.info("Creating new user");
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
operationStatus = theUserDao.createUser(userName); //DAO layer is used to register user using gathered data
|
||||
boolean operationStatus = theUserDao.createUser(userName);
|
||||
context.isValidationFailed();
|
||||
if (operationStatus) {
|
||||
|
||||
operationMessage = "User " + userName + " created";
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Logger.getAnonymousLogger().severe("Error registering new user ");
|
||||
LOGGER.error("Error registering new user ");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String returnHome() {
|
||||
return "home";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userName the name to set
|
||||
*/
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
@@ -79,16 +62,10 @@ public class RegistrationBean implements Serializable {
|
||||
return this.theUserDao;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the operationMessage
|
||||
*/
|
||||
public String getOperationMessage() {
|
||||
return operationMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param operationMessage the operationMessage to set
|
||||
*/
|
||||
public void setOperationMessage(String operationMessage) {
|
||||
this.operationMessage = operationMessage;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user