1 16 package org.apache.myfaces.custom.fileupload; 17 18 import javax.faces.component.UIComponent; 19 import javax.faces.context.FacesContext; 20 import javax.faces.convert.Converter; 21 import javax.faces.convert.ConverterException; 22 23 28 public class UploadedFileConverter 29 implements Converter 30 { 31 public Object getAsObject(FacesContext facescontext, UIComponent uicomponent, String s) 32 throws ConverterException 33 { 34 return null; 35 } 36 37 public String getAsString(FacesContext facescontext, UIComponent uicomponent, Object obj) 38 throws ConverterException 39 { 40 if (obj instanceof UploadedFile) 41 { 42 return ((UploadedFile)obj).getName(); 43 } 44 else 45 { 46 return null; 47 } 48 } 49 } 50 | Popular Tags |