I have been using the component assigned messages in the following manner:

  | @IfInvalid(outcome = REDISPLAY)
  | public String create() {
  |         
  |   if(poCoupling.getSize().getId()==null) {
  |     facesMessages.add("size", new FacesMessage("Size required"));
  |   }
  |         
  |   if(poCoupling.getGrade().getId()==null) {
  |     facesMessages.add("grade", new FacesMessage("Grade required"));         
  |   }
  |         
  |   if(!facesMessages.isEmpty()) return null;
  |                    
  |   poCouplingDAO.makePersistent(poCoupling);
  | 
  |   return "nothing";
  | }
  | 

I added the following method to FacesMessages in order to check to see if I 
should redisplay the form.


  | public boolean isEmpty() { 
  |   if(facesMessages.size()==0 && keyedFacesMessages.size()==0) {
  |     return true;
  |   } else {
  |     return false; 
  |   }
  | }
  | 

I need to check for the presence of an id in my objects because they are 
connected to a dropdown and if the id is null I get an 
org.hibernate.TransientObjectException.

Is there an existing way to do this?  If not, how do you feel about adding this 
funtionality?

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

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


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to