[jboss-user] [JBoss Seam] - Re: Converter Issue

rvkishore do-not-reply at jboss.com
Sun Dec 2 19:39:33 EST 2007


xshuang,
below is the code for my CategoryConverter.

  | import javax.faces.component.UIComponent;
  | import javax.faces.context.FacesContext;
  | import javax.faces.convert.ConverterException;
  | 
  | import org.jboss.seam.Component;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.annotations.faces.Converter;
  | 
  | import com.datalette.actions.CategoryIntf;
  | import com.datalette.model.Category;
  | 
  | @Name("categoryConverter")
  | @Converter
  | public class CategoryConverter implements javax.faces.convert.Converter
  | {
  | 
  |    public Object getAsObject(FacesContext context, UIComponent component,
  | 		   String value) throws ConverterException
  |    {
  |       Integer i = new Integer(value);
  |       CategoryIntf categoryAction = (CategoryIntf)Component.getInstance("categoryAction");
  |       return categoryAction.getCategory(i);
  |    }
  | 
  |    public String getAsString(FacesContext context, UIComponent component,
  | 		   Object value) throws ConverterException
  |    {
  |       return ((Category)value).getId().toString();
  |    }
  | }

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

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



More information about the jboss-user mailing list