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


Java FacesMessages类代码示例

本文整理汇总了Java中org.jboss.seam.faces.FacesMessages的典型用法代码示例。如果您正苦于以下问题:Java FacesMessages类的具体用法?Java FacesMessages怎么用?Java FacesMessages使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FacesMessages类属于org.jboss.seam.faces包,在下文中一共展示了FacesMessages类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: cancel

import org.jboss.seam.faces.FacesMessages; //导入依赖的package包/类
@Transactional
public void cancel() {
    Payment payment = getInstance();
    
    QuartzTriggerHandle handle = payment.getQuartzTriggerHandle();
    payment.setQuartzTriggerHandle(null);
    payment.setActive(false);
    
    try
    {
        handle.cancel();
    }
    catch (Exception nsole)
    {
        FacesMessages.instance().add("Payment already processed");
    }
}
 
开发者ID:windup,项目名称:windup-rulesets,代码行数:18,代码来源:PaymentHome.java

示例2: changePassword

import org.jboss.seam.faces.FacesMessages; //导入依赖的package包/类
@End
public String changePassword() {
	List<User> users = this.entityManager
			.createQuery("from User u where u.username=:username")
			.setParameter("username",
					Identity.instance().getCredentials().getUsername())
			.getResultList();
	User user = null;
	if (users != null && users.size() == 1) {
		user = users.get(0);
	}
	if (!user.getPassword().equals(this.getOldPassword())) {
		FacesMessages.instance().add("La vecchia password e' sbagliata");
		return "changePassword";
	}
	if (this.getNewPassword().equals(this.getOldPassword())) {
		FacesMessages.instance().add(
				"La nuova password deve essere diversa dalla vecchia");
		return "changePassword";
	}
	if (!this.getConfirmPassword().equals(this.getNewPassword())) {
		FacesMessages.instance().add("Le password non coincidono");
		return "changePassword";
	}
	user.setPassword(this.getNewPassword());
	this.entityManager.merge(user);
	FacesMessages.instance().add("Password aggiornata");
	return "home";

}
 
开发者ID:lablita,项目名称:ridire-cpi,代码行数:31,代码来源:ChangePassword.java

示例3: cancel

import org.jboss.seam.faces.FacesMessages; //导入依赖的package包/类
public void cancel()
{
   log.info("Cancel booking: #{bookingList.booking.id} for #{user.username}");
   Booking cancelled = em.find(Booking.class, booking.getId());
   if (cancelled!=null) em.remove( cancelled );
   getBookings();
   FacesMessages.instance().add("Booking cancelled for confirmation number #0", booking.getId());
}
 
开发者ID:windup,项目名称:windup,代码行数:9,代码来源:BookingListAction.java

示例4: getFacesMessages

import org.jboss.seam.faces.FacesMessages; //导入依赖的package包/类
/**
 * @return the facesMessages
 */
public FacesMessages getFacesMessages() {
    return facesMessages;
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:7,代码来源:UpdateAttributeAction.java

示例5: setFacesMessages

import org.jboss.seam.faces.FacesMessages; //导入依赖的package包/类
/**
 * @param facesMessages the facesMessages to set
 */
public void setFacesMessages(FacesMessages facesMessages) {
    this.facesMessages = facesMessages;
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:7,代码来源:UpdateAttributeAction.java

示例6: download

import org.jboss.seam.faces.FacesMessages; //导入依赖的package包/类
public String download(LocalResource localResource)
		throws FileHandlingException {
	if (localResource == null) {
		FacesMessages.instance().add(
				"Impossibile recuperare il documento.", null);
		return "Dowload_ko";
	}
	HttpServletResponse response = (HttpServletResponse) this.extCtx
			.getResponse();
	String mimeType = localResource.getContentType();
	if (mimeType == null) {
		mimeType = "application/octet-stream";
	}
	response.setContentType(mimeType);
	response.addHeader("Content-disposition", "attachment; filename=\""
			+ localResource.getOrigFileName() + "\"");
	String localResourceDir = this.entityManager.find(Parameter.class,
			Parameter.LOCAL_RESOURCES_DIR.getKey()).getValue();
	File file = new File(new File(localResourceDir),
			localResource.getUniqueFileName());
	InputStream fis;
	try {
		fis = new FileInputStream(file);
		byte[] buf = new byte[(int) file.length()];
		// Read in the bytes
		int offset = 0;
		int numRead = 0;
		while (offset < buf.length
				&& (numRead = fis.read(buf, offset, buf.length - offset)) >= 0) {
			offset += numRead;
		}

		// Ensure all the bytes have been read in
		if (offset < buf.length) {
			throw new IOException("Could not completely read file "
					+ file.getName());
		}
		// Close the input stream and return bytes
		fis.close();
		ServletOutputStream os = response.getOutputStream();
		os.write(buf);
		os.flush();
		os.close();
		FacesContext.getCurrentInstance().responseComplete();
	} catch (FileNotFoundException e1) {
		throw new FileHandlingException(
				this.messages.get("FileRetrievingError"));
	} catch (IOException e) {
		throw new FileHandlingException(
				this.messages.get("FileRetrievingError"));
	}
	return "Download ok";
}
 
开发者ID:lablita,项目名称:ridire-cpi,代码行数:54,代码来源:DocumentDownloader.java


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