[jboss-user] [JBoss Seam] - Re: Complex validation

supernovasoftware.com do-not-reply at jboss.com
Fri Feb 9 13:07:34 EST 2007


I have a lot of complex validations in my project.

I just put the logic in my action method and add the appropriate messages to a map as feed it to the function below.

If messages were added I redirect to the same page.  This seems like an old fashioned what to do things, but I have not found a more JSF way to do this.

If anyone has a better solution, please let me know.

My validations are more complex than just inspecting the object to be persisted.  I need to query the EntityManager to see if these changes are acceptable, not simply compare a few properties on an object.

I also do not like to have to put required="true" in order to validate null fields.


Is there any way around this? 
Could Seam be made to override the default JSF implementation behavior in this case? 


  |   public int addMessages(Map<String, String> m)
  |   {
  |     for(String key : m.keySet()) 
  |     { 
  |       if(key.startsWith("globalMessage")) 
  |       {
  |         FacesMessages.instance().add(m.get(key));
  |       } 
  |       else
  |       {
  |         FacesMessages.instance().add(key, m.get(key));
  |       }      
  |     }
  |     return m.size();
  |   }
  | 

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

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



More information about the jboss-user mailing list