本文整理汇总了Java中org.springframework.web.jsf.FacesContextUtils.getWebApplicationContext方法的典型用法代码示例。如果您正苦于以下问题:Java FacesContextUtils.getWebApplicationContext方法的具体用法?Java FacesContextUtils.getWebApplicationContext怎么用?Java FacesContextUtils.getWebApplicationContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.web.jsf.FacesContextUtils
的用法示例。
在下文中一共展示了FacesContextUtils.getWebApplicationContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configura
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
public String configura() {
WebApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
SimpleConfigService serviceConfig = ctx.getBean(SimpleConfigService.class);
SimpleVotableOptionService serviceVo = ctx.getBean(SimpleVotableOptionService.class);
FacesContext fc = FacesContext.getCurrentInstance();
try {
ConfigurationElection conf = new ConfigurationElection(getName(), getDescription(), getApplicationStart(),
getApplicationEnd(), getVotationStart(), getVotationEnd(), getVotableOptions(), getElectoralColleges(),
isMultipleVoting());
relacionaOpcionesVotoConf(getVotableOptions(), conf);
serviceConfig.saveConfiguration(conf);
serviceVo.saveVotableOption(getVotableOptions());
fc.addMessage("laInfo", new FacesMessage(FacesMessage.SEVERITY_INFO, "Info", "Se ha guardado su configuración."));
} catch (Exception e) {
fc.addMessage("elError", new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "Error al guardar la configuración"));
return null;
}
return null;
}
示例2: validar
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
@Override
public String validar(String email, String password) {
WebApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
CheckUserR vs = ctx.getBean(CheckUserR.class);
try {
vs.validar(email, password);
} catch (InvalidUserException e) {
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "", e.getMessage());
FacesContext.getCurrentInstance().addMessage("form-cuerpo:all", msg);
return "fracaso";
}
return "exito";
}
示例3: configura
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
public String configura() {
WebApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
InsertConfigurationR serviceConfig = ctx.getBean(InsertConfigurationR.class);
FacesContext fc = FacesContext.getCurrentInstance();
try {
ConfigurationElection conf = new ConfigurationElection(getName(), getDescription(), getApplicationStart(),
getApplicationEnd(), getVotationStart(), getVotationEnd(), getVotableOptions(), getElectoralColleges(),
isMultipleVoting());
relacionaOpcionesVotoConf(getVotableOptions(), conf);
serviceConfig.saveConfiguration(conf);
serviceConfig.saveVotableOption(getVotableOptions());
fc.addMessage("laInfo", new FacesMessage(FacesMessage.SEVERITY_INFO, "Info", "Se ha guardado su configuración."));
} catch (Exception e) {
fc.addMessage("elError", new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "Error al guardar la configuración"));
return null;
}
return null;
}
示例4: validar
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
public String validar(){
WebApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
ValidatorService vs = ctx.getBean(ValidatorService.class);
try {
vs.validar(email, password);
} catch (InvalidUserException e) {
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "", e.getMessage());
FacesContext.getCurrentInstance().addMessage("form-cuerpo:all", msg);
return "fracaso";
}
return "exito";
}
示例5: getList
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
public List<ConfigurationElection> getList() {
WebApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
VoteService vs = ctx.getBean(VoteService.class);
list = vs.getElections();
return list;
}
示例6: getVotableOptions
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
public List<VotableOption> getVotableOptions(ConfigurationElection configurationElection) {
WebApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
VoterVoteService vvs = ctx.getBean(VoterVoteService.class);
this.configurationElection = configurationElection;
return vvs.getVotableOptions(configurationElection);
}
示例7: getVotes
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
public List<Vote> getVotes(ConfigurationElection configurationElection) {
WebApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
VoterVoteService vvs = ctx.getBean(VoterVoteService.class);
this.configurationElection = configurationElection;
List<VotableOption> miLista=vvs.getVotableOptions(configurationElection);
votos=new ArrayList<Vote>();
Date d= new Date();
for(VotableOption v: miLista){
votos.add(new Vote(d, v, 0));
}
return votos;
}
示例8: verify
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
public String verify() {
WebApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
SimpleLoginMesaService login = ctx.getBean(SimpleLoginMesaService.class);
LugarVoto mesa = login.verify(id, password);
if (mesa != null) {
putMesaInSession(mesa);
return "principalMesa";
}
setResult("Contraseña o identificador incorrecto");
return null;
}
示例9: votar
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public String votar(OpcionVoto opcion) {
WebApplicationContext ctx = FacesContextUtils
.getWebApplicationContext(FacesContext.getCurrentInstance());
SimpleVoteService vote = ctx.getBean(SimpleVoteService.class);
WebApplicationContext ctx1 = FacesContextUtils
.getWebApplicationContext(FacesContext.getCurrentInstance());
SimpleConfiguracionService config = ctx1.getBean(SimpleConfiguracionService.class);
Configuracion c = config.getConf();
String s = getFecha(c.getFecha().toString());
Voto v = vote.getVoteBy(opcion.getNombre());
Timestamp actual = new Timestamp(new Date().getTime());
String act = getFecha(actual.toString());
if (act.contains(s) && actual.getHours() >= c.getHoraInicio()
&& actual.getHours() <= c.getHoraFin()) {
if (v != null)
vote.updateVote(opcion.getNombre());
else
vote.insertVote(opcion.getNombre());
setResult("Ya ha votado, no puede realizar mas votos");
setVotado(true);
} else {
setVotado(true);
setResult("Esta fuera de plazo de votacion");
}
return null;
}
示例10: opcionesVoto
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
public void opcionesVoto() {
WebApplicationContext ctx = FacesContextUtils
.getWebApplicationContext(FacesContext.getCurrentInstance());
SimpleOptionVoteService vote = ctx.getBean(SimpleOptionVoteService.class);
votos = (OpcionVoto[]) vote.getAllVoteOptions().toArray(new OpcionVoto[0]);
}
示例11: verify
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public String verify() {
WebApplicationContext ctx = FacesContextUtils
.getWebApplicationContext(FacesContext.getCurrentInstance());
SimpleLoginService login = ctx.getBean(SimpleLoginService.class);
WebApplicationContext ctx1 = FacesContextUtils
.getWebApplicationContext(FacesContext.getCurrentInstance());
SimpleConfiguracionService config = ctx1
.getBean(SimpleConfiguracionService.class);
Configuracion c = config.getConf();
String s = getFecha(c.getFecha().toString());
Timestamp actual = new Timestamp(new Date().getTime());
String act = getFecha(actual.toString());
if (act.contains(s) && actual.getHours() >= c.getHoraInicio()
&& actual.getHours() <= c.getHoraFin()) {
boolean yaVoto = login.comprobarUsuario(dni);
if (!yaVoto) {
UserLogin user = login.verify(dni, password);
if (user != null) {
putUserInSession(user);
return "principal";
}
setResult("Contraseña o usuario incorrecto");
} else {
setResult("Este usuario ya ha votado");
}
} else {
setResult("Actualmente no hay ninguna votaciones disponibles");
}
return null;
}
示例12: getVotes
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
public List<Vote> getVotes(ConfigurationElection configurationElection) {
WebApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
LoadVoteR vvs = ctx.getBean(LoadVoteR.class);
this.configurationElection = configurationElection;
List<VotableOption> miLista=vvs.getVotableOptions(configurationElection);
votos=new ArrayList<Vote>();
Date d= new Date();
for(VotableOption v: miLista){
votos.add(new Vote(d, v, 0));
}
return votos;
}
示例13: getList
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
public List<ConfigurationElection> getList() {
WebApplicationContext ctx = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
GetElectionListR vs = ctx.getBean(GetElectionListR.class);
list = vs.getElections();
return list;
}
示例14: verify
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public String verify() {
WebApplicationContext ctx = FacesContextUtils
.getWebApplicationContext(FacesContext.getCurrentInstance());
LoginService login = ctx.getBean(SimpleLoginService.class);
WebApplicationContext ctx1 = FacesContextUtils
.getWebApplicationContext(FacesContext.getCurrentInstance());
ConfiguracionService config = ctx1
.getBean(SimpleConfiguracionService.class);
Configuracion c = config.getConf();
String s = getFecha(c.getFecha().toString());
Timestamp actual = new Timestamp(new Date().getTime());
String act = getFecha(actual.toString());
if (act.contains(s) && actual.getHours() >= c.getHoraInicio()
&& actual.getHours() <= c.getHoraFin()) {
boolean yaVoto = login.comprobarUsuario(dni);
if (!yaVoto) {
UserLogin user = login.verify(dni, password);
if (user != null) {
putUserInSession(user);
return "principal";
}
setResult("Contraseña o usuario incorrecto");
} else {
setResult("Este usuario ya ha votado");
}
} else {
setResult("Actualmente no hay ninguna votaciones disponibles");
}
return null;
}
示例15: votar
import org.springframework.web.jsf.FacesContextUtils; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public String votar(OpcionVoto opcion) {
WebApplicationContext ctx = FacesContextUtils
.getWebApplicationContext(FacesContext.getCurrentInstance());
VoteService vote = ctx.getBean(SimpleVoteService.class);
WebApplicationContext ctx1 = FacesContextUtils
.getWebApplicationContext(FacesContext.getCurrentInstance());
ConfiguracionService config = ctx1.getBean(SimpleConfiguracionService.class);
Configuracion c = config.getConf();
String s = getFecha(c.getFecha().toString());
Voto v = vote.getVoteBy(opcion.getNombre());
Timestamp actual = new Timestamp(new Date().getTime());
String act = getFecha(actual.toString());
if (act.contains(s) && actual.getHours() >= c.getHoraInicio()
&& actual.getHours() <= c.getHoraFin()) {
if (v != null)
vote.updateVote(opcion.getNombre());
else
vote.insertVote(opcion.getNombre());
setResult("Ya ha votado, no puede realizar mas votos");
setVotado(true);
} else {
setVotado(true);
setResult("Esta fuera de plazo de votacion");
}
return null;
}