[jboss-user] [JBoss Seam] - Re: FlushModeType.MANUAL in conversation

Lundegaard do-not-reply at jboss.com
Thu Jan 31 08:05:41 EST 2008


See the posted code below to see how to validate the input.


  | /**
  |  * @author Thomas Maerz (thomas.maerz at primedo.com)
  |  */
  | @Name("userHome")
  | public class UserHome extends EntityHome<User> {
  | 
  | 	private static final long serialVersionUID = 1L;
  | 
  | 	@In
  | 	UserDao userDao;
  | 
  | 	public void validateUsername(FacesContext context, UIComponent component, Object value) throws ValidatorException {
  | 		User user = userDao.getByUsername((String) value);
  | 		if (user == null || user.getId().equals(getInstance().getId())) {
  | 			return;
  | 		}
  | 		throw new ValidatorException(new FacesMessage(""));
  | 	}
  | }
  | 

edit.html

  | 	<s:decorate template="/templates/edit.html">
  | 		<ui:define name="label">Username</ui:define>
  | 		<h:inputText value="#{userHome.instance.username}" validator="#{userHome.validateUsername}" required="true"/>	
  | 	</s:decorate>
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4125131#4125131

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4125131



More information about the jboss-user mailing list