-
1. Re: Convertors validators
chawax Mar 28, 2008 3:42 PM (in response to kaboel.repel.steel.scarlet.be)If I remember well, I had to add @BypassInterceptors annotation to my converter / validator Seam component class to make it work. Hope it will help.
-
2. Re: Convertors validators
kaboel.repel.steel.scarlet.be Mar 28, 2008 7:19 PM (in response to kaboel.repel.steel.scarlet.be)I's not an annotation problem
The context of a Convertor is the tag (outputText)I would like to read the XML attributes of
f:convertorxxx
-
3. Re: Convertors validators
pmuir Mar 29, 2008 7:19 PM (in response to kaboel.repel.steel.scarlet.be)You're going to need to explain yourself a lot more clearly than this to get help.
-
4. Re: Convertors validators
barbacena Mar 29, 2008 9:16 PM (in response to kaboel.repel.steel.scarlet.be)There are 2 ways:
- JSF way: every property with f:converter will be bind to a bean pproperty in your validator class (remember that it is a string no EL). You need to implement StateHolder to save this properties with the validator. Look here the DateTimeConverter of JSF.
- My way :-): add a <f:attribute name="yourPropertyName" value="#{} or anything" /> and at the validator use component.getAttributes().get("yourPropertyName") to retreive the String. This way you don't need to implement StateHolder as the property will be properly saved with the component.
Summaryzing the uses:
- JSF
<c:inputText ...> <f:converter someProperty="foo" converterId="seamname" /> </c:inputText> @Name("seamname") @BypassInterceptors @Converter public class YourClass implements Converter, StateHolder { private String someProperty; public String getSomeProperty() { return someProperty; } public void setSomeProperty(String value) { someProperty = value; } ... // ValueHolder and Converter methods }
- My way
<c:inputText ...> <f:converter converterId="seamname" /> <f:attribute name="someProperty" value="someValue" /> </c:inputText> @Name("seamname") @BypassInterceptors @Converter public class YourClass implements Converter { private String getSomeProperty(UIComponent component) { Object o = component.getAttributes().get("someProperty"); return o != null ? o.toString() : null; // or "". } // Converter methods that retrieve the property value with the method above }
Hope that helps.
-
5. Re: Convertors validators
kaboel.repel.steel.scarlet.be Mar 31, 2008 9:32 AM (in response to kaboel.repel.steel.scarlet.be)I'm going to try that immediatly
in any case already a big thanks.
I'll get back to you -
6. Re: Convertors validators
kaboel.repel.steel.scarlet.be Mar 31, 2008 11:57 AM (in response to kaboel.repel.steel.scarlet.be)The
myway
works like a dream, thanks a lotI still heve problems with the JSF way
in the sense that some EL expressions do not get
translted (State Holder seams to play special tricks)I did not Use as Seam Vonvertor
@Name(
seamname
)
@BypassInterceptors
@Converter
since I've doubths on where to place the module
(seam injection and seam propertie)
I classify in the facelets (web-Inf) area
But all that I can live with.
A thousand thanks.
-
7. Re: Convertors validators
barbacena Mar 31, 2008 5:39 PM (in response to kaboel.repel.steel.scarlet.be)I couldn't understand your last concerns this time.
Try again :D