[jboss-user] [JBoss Seam] - Re: Problems with extended EL syntax.
Delphi's Ghost
do-not-reply at jboss.com
Sun Apr 15 22:23:54 EDT 2007
Here's my take on it, I'm not a seam expert, but I have had my fair share of these types of problems. However, trying some or all of these ideas may help you out.
I believe that the standard JSF way of accessing a list (i.e. MyBean.myList) isn't good enough for the enhanced EL syntax, nor for the DataModelSelection, you need to make into a "seam variable".
You can see this in action in the UI demo in the examples directory, just look at the Factories.java code :
| @Name("factories")
| public class Factories
| {
| @Factory("honorifics")
| public Honorific[] getHonorifics() {
| return Honorific.values();
| }
|
| }
|
|
I'm guessing here, they provide a method which can be used to generate the honorifics array and provide it as a seam contexted variable called "honorifics"
So, in your action bean (you didn't say what datatype strings is (list, array etc), but assuming a list), you have :
|
| List<String> strings;
|
| @Factory("strings")
| public makeStrings() {
| strings = new List<String>();
| strings.add("Name1");
| strings.add("Name2");
| }
|
|
In your page, you use :
| <h:dataTable var="string" value="#{strings}>
|
Where strings is the name of your factory generated seam variable.
Alternatively, in your bean, you could just put :
| @DataModel
| List<String>strings;
|
and make your web page code the same as above. This essentially does the same thing, creating a seam variable with the name strings, which you can access from your page.
I'm sure someone with more knowledge and/or experience will correct me, but this might get you started on your way.
If you have no luck, post a bit more of your simple test (page and action bean code) and I'm sure I, or someone else will be able to find the answer.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037416#4037416
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037416
More information about the jboss-user
mailing list