-
1. Re: components.xml configuring a simple type component
wrzep Jun 24, 2008 12:09 PM (in response to gonzalad)<factory name="pageSize" value="10" scope="APPLICATION">
btw .properties files are really handy to store properties. Then you don't have to search whole components.xml file to find a property :)
-P
-
2. Re: components.xml configuring a simple type component
wrzep Jun 24, 2008 12:19 PM (in response to gonzalad)Oh, the above produced String :) To get Long, of course:
<factory name="pageSize" value"#{10}" scope"APPLICATION" auto-create="true">
Cheers, -Pawel
-
3. Re: components.xml configuring a simple type component
gonzalad Jun 24, 2008 12:46 PM (in response to gonzalad)Thanks,
Just tested it and ran into the same Long and String troubles.
One last question : is it possible to obtain an Integer with this solution ? [1]
Thanks very much
[1] I'm obtaining :
java.lang.IllegalArgumentException: Could not set field value by reflection: RechercherInterlocuteurAction.pageSize on: com.xxx.RechercherInterlocuteurAction with value: class java.lang.Long)
-
4. Re: components.xml configuring a simple type component
wrzep Jun 24, 2008 12:59 PM (in response to gonzalad)Heh, don't know why it produces Long instead of Integer... Prolly it has something to do with EL conversions. If you happen to find the answer lemme know :D
-Pawel
-
5. Re: components.xml configuring a simple type component
gonzalad Jun 24, 2008 4:10 PM (in response to gonzalad)Sorry Pawel, didn't found.
I've read an extract of JSR 52, chapter A.3.2 on literal handling (Integer litteral are handled as IntegerLiteral in section A.8 - IntegerLiteral only specifies syntax - not java type).
So, don't know if Integer literals are mapped to Integer or Long.
From another chapter of the spec, A.3.5, results of binary operation are coerced to Float, Double, String, Long but never coerced to Integer.
I've also tried to add an el function like :
<factory name="pageSize" value="#{sx:intValue(10)}" scope="APPLICATION" auto-create="true"/>
But I don't know how to register it in order to be handled in components.xml (perhaps registering a custom application-factory in faces-config.xml but it appears to me to be overkill).
If anyone has an idea on the subject I'm really interested.
Otherwise, if I need to handle Integers literals in components.xml, I'll use a Holder object approach (as PageSettings), and if I need Long or String, I'll use the simpler approach.
-
6. Re: components.xml configuring a simple type component
stephen Jun 24, 2008 4:25 PM (in response to gonzalad)I no longer use EL functions with Seam:
Simply create an application scoped seam component named for exampleutil
and use it from el:value="#{util.intValue(10)}"
-
7. Re: components.xml configuring a simple type component
gonzalad Jun 24, 2008 4:33 PM (in response to gonzalad)value="#{util.intValue(10)}"
Oups !
This is a simple and good solution thanks Stephen !