Can I pass in an object?

I switched to Validator an the code is way cleaner.  See below.  I was able to 
remove the inner class which I did not like.

The only side effect that I am not fond of is that JSF intercepts the 
validation if something other than a number is entered.

Before my message was consistent.  Now I get the generic JSF message in the 
case.  Can I bypass and handle this myself?

I will continue to consider the a solution, but I need to do something visible. 
 My client just does not understand.  "I spent all day trying to set up a 
validation."


  | @Stateless
  | @Name("genericItemNumPieces")
  | @Interceptors(SeamInterceptor.class)
  | public class GenericItemNumPiecesConverterBean implements 
GenericItemNumPiecesConverterInterface
  | {
  |   @Logger
  |   private Log log;
  | 
  |   @PersistenceContext
  |   EntityManager em;
  | 
  |   @In(create = true)
  |   FacesMessages facesMessages;
  | 
  |   private void addMessage(UIComponent component)
  |   {
  |     ((UIInput) component).setValid(false);
  |     facesMessages.add(component.getId(), new FacesMessage("The number of 
pieces must be >= 0."));
  |   }
  | 
  |   public void validate(FacesContext facesContext, UIComponent component, 
Object obj) throws ValidatorException
  |   {
  |     Long numPieces = (Long) obj;
  |     if (numPieces < 0) addMessage(component);
  |   }
  | }
  | 


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

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

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to