Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Stanimir Stamenkov Newsgroups: comp.lang.java.programmer Subject: Re: JSF feeds a Set into a Set Date: Sat, 04 Jun 2011 17:42:15 +0300 Organization: A noiseless patient Spider Lines: 50 Message-ID: References: <4de7e53a$0$21180$426a34cc@news.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 4 Jun 2011 14:42:04 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="VdcnnljfizG2LUdZ5iOA6g"; logging-data="24383"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/p9oGiWq1jbJf3rcxSQHpw" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20110520 SeaMonkey/2.1 In-Reply-To: <4de7e53a$0$21180$426a34cc@news.free.fr> X-Face: )>>ChyF_H I am currently learning JSF2.0, and have just encountered a behavior > I do not understand. Basically, I have a test case (see below) where > I have a typed set (Set) whose content, automatically populated > by JSF, is made of strings (Set). This should not even > compile, yet this runs. What am I missing? > (...) You're missing the generics type erasure [1]. JSF doesn't have the generics type information at run time. A related (but not the same) issue [2] has been brought to the JSF Dev mailing list. To resolve the issue you could attach converter to your input component explicitly, e.g.: ... where you bind the converter instance directly, or: ... where you provide a registered converter ID. With JSF 1.2 one register a custom converter by adding such an element in the "faces-config.xml" file: test.FooConverter test.faces.FooConverter JSF 2.0 may provide more convenient annotation placed on the converter class directly (don't know, I have really no JSF 2 experience, yet). [1] http://download.oracle.com/javase/tutorial/java/generics/erasure.html [2] "JSF & Support for Generic Types... Again..." -- Stanimir