This content has been marked as final.
Show 4 replies
-
1. Re: simple converter problem
meetoblivion Jan 7, 2009 1:28 PM (in response to deanhiller2000)I think you want your converter called like this..
converter="#{companyConverter}"
assuming your converter is properly annotated. how is it annotated currently?
-
2. Re: simple converter problem
deanhiller2000 Jan 7, 2009 4:20 PM (in response to deanhiller2000)man, I got all excited but that didn't work. here is my java code...
@Name("companyConverter") @BypassInterceptors @org.jboss.seam.annotations.faces.Converter public class SaasCompanyConverter implements Converter { private Map<String, SaasCompany> map = new HashMap<String, SaasCompany>(); @Override public Object getAsObject(FacesContext arg0, UIComponent comp, String s) { SaasCompany saasCompany = map.get(s); return saasCompany; } @Override public String getAsString(FacesContext arg0, UIComponent comp, Object obj) { if(obj == null) return null; SaasCompany company = (SaasCompany)obj; map.put(company.getAlias(), company); return company.getAlias(); } }
Here is my html again...
<s:validateAll> <s:decorate id="comDecorate" template="../../web/zlogin/errorTemplate.xhtml"> <ui:define name="label">Company:</ui:define> <h:selectOneMenu id="com" value="#{buyApplication.company}" converter="#{companyConverter}"> <s:selectItems value="#{companies}" var="comp" label="#{comp.alias}" noSelectionLabel="Please Select..." /> </h:selectOneMenu> </s:decorate> </s:validateAll>
-
3. Re: simple converter problem
deanhiller2000 Jan 7, 2009 4:23 PM (in response to deanhiller2000)Why is always using a new instance? Shouldn't it reuse the same instance? it is so weird....must be something simple.
-
4. Re: simple converter problem
deanhiller2000 Jan 7, 2009 4:28 PM (in response to deanhiller2000)oh, I didn't know scope could be set on converters. That fixed it. I thought converters would always have to be the same standard scope....weird. oh well, scope of conversation fixed it.
later,
Dean