I've submitted a patch for UIFileUpload. http://jira.jboss.com/jira/browse/JBSEAM-1981
With this patch you can use the hibernate validator framework. For example I've done an Image annotation which check if a byte[] can be read by ImageIO. | @ValidatorClass(ImageValidator.class) | @Target({ElementType.FIELD, ElementType.METHOD}) | @Retention(RetentionPolicy.RUNTIME) | @Documented | public @interface Image { | String message() default "not a valid image"; | } | | public class ImageValidator implements Validator<Image> { | | public void initialize(Image parameters) { | } | | public boolean isValid(Object value) { | if( value == null ) return true; | if( ! (value instanceof byte[]) ) return false; | | byte[] data = (byte[])value; | | try { | BufferedImage img = | ImageIO.read( new ByteArrayInputStream( data ) ); | | return img == null ? false : true; | } catch (IOException e) { | return false; | } | } | } | So you can use it in your Entity | @Entity | public class AnEntity { | @Lob | @Image | private byte[] data; | | ... | } | In the Facelets : | <s:fileUpload id="uplEditedImage" value="#{image.data}"/> | About my last post, I'm not quite right :) file upload occur during the apply request value phase but the submittedValue attribute wasn't set and the ModelValidator need a "value" attribute instead of "data". View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4089282#4089282 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4089282 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user