[jboss-user] [JBoss Seam] - Re: getAsObject not being called - why?
archana_mannepalli
do-not-reply at jboss.com
Wed Jan 30 07:13:28 EST 2008
but am getting this exception:
javax.faces.convert.ConverterException: java.lang.NullPointerException
for anyone if its working plese send me the code:
and my class is:
package org.domain.Portal.entity;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.ConverterException;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.faces.Converter;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.log.Log;
@Name("tst")
@Scope(ScopeType.APPLICATION)
@BypassInterceptors
@Converter
public class Tst implements javax.faces.convert.Converter {
@Logger private Log log;
public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) throws ConverterException {
try {
arg2 = "true";
log.warn("MyConverter.getAsObject action called");
return (arg2 == null || arg2.equals("") || arg2.equals("0") || arg2.equals("false") ? new Integer(0) : new Integer(1));
} catch (Exception e) {
throw new ConverterException(e);
}
}
public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) throws ConverterException {
try {
log.warn("MyConverter.getAsString action called"+arg2);
if (arg2 instanceof Boolean)
{
return (arg2 == null || ((Boolean)arg2).equals(false) ? "N" : "Y");
}
else
return (arg2 == null || ((Integer)arg2).intValue() == 0 ? "false" : "true");
} catch (Exception e) {
throw new ConverterException(e);
}
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4124739#4124739
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4124739
More information about the jboss-user
mailing list