当前位置: 首页>>代码示例>>Java>>正文


Java FacesContextUtils.getWebApplicationContext方法代码示例

本文整理汇总了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;
}
 
开发者ID:Arquisoft,项目名称:VotingSystem_1b,代码行数:21,代码来源:BeanConfiguration.java

示例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";
	
}
 
开发者ID:Arquisoft,项目名称:Voting_1b,代码行数:17,代码来源:ValidateP.java

示例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;
}
 
开发者ID:Arquisoft,项目名称:Voting_1b,代码行数:21,代码来源:CreateConfigurationP.java

示例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";
}
 
开发者ID:Arquisoft,项目名称:VotingSystem_1b,代码行数:15,代码来源:BeanValidator.java

示例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;
}
 
开发者ID:Arquisoft,项目名称:VotingSystem_1b,代码行数:8,代码来源:BeanVoter.java

示例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);
}
 
开发者ID:Arquisoft,项目名称:VotingSystem_1b,代码行数:8,代码来源:BeanOptions.java

示例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;
}
 
开发者ID:Arquisoft,项目名称:VotingSystem_1b,代码行数:14,代码来源:BeanLoadVotes.java

示例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;
}
 
开发者ID:Arquisoft,项目名称:VotingSystem_1a,代码行数:13,代码来源:BeanLoginMesa.java

示例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;
}
 
开发者ID:Arquisoft,项目名称:VotingSystem_1a,代码行数:32,代码来源:BeanVoto.java

示例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]);
}
 
开发者ID:Arquisoft,项目名称:VotingSystem_1a,代码行数:8,代码来源:BeanVoto.java

示例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;
}
 
开发者ID:Arquisoft,项目名称:VotingSystem_1a,代码行数:39,代码来源:BeanLogin.java

示例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;
}
 
开发者ID:Arquisoft,项目名称:Voting_1b,代码行数:14,代码来源:SelectVoteP.java

示例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;
}
 
开发者ID:Arquisoft,项目名称:Voting_1b,代码行数:8,代码来源:ListElectionP.java

示例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;
}
 
开发者ID:Arquisoft,项目名称:Voting_1a,代码行数:40,代码来源:BeanLoginImpl.java

示例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;
}
 
开发者ID:Arquisoft,项目名称:Voting_1a,代码行数:33,代码来源:BeanVotoImpl.java


注:本文中的org.springframework.web.jsf.FacesContextUtils.getWebApplicationContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。