Darstellung von Set-Elementen in JSF

M

Michael Plate

Hallo Leute!

ich hab ein Problem und brauche eure fachliche Kompetenz zur Lösung.

Folgendes:
Ich hab ein Object A mit einen Set an weiteren Objects B und wird als Liste
per Hibernate aus der DB geladen.

class B {
int id;
String description;
//getter and setter
}

class A{
int id;
String description;
Set<B> listOfBs;
//getter and setter
}

In der JSP mit JSF-Tags kommt <h:dataTable zum Einsatz um eine komplette
Liste darzustellen. Ich bin soweit, dass alle Properties aus A angezeigt
werden, aber mein Problem ist die Darstellung aller B Elemente (Set). Bis
jetzt erhalte ich nichts zurück oder eine Fehlermeldung. Die Objekte werden
von Hibernate komplett eingelesen. Ein Problem mit Lazy-Loading gibt es
nicht.

<h:dataTable ....>
<h:column>
<f:facet name="header">
<h:eek:utputText value="#{msgs.a_description}" />
</f:facet>
<h:eek:utputText value="#{record.description}" />
</h:column>
...
<h:column>
<f:facet name="header">
<h:eek:utputText value="#{msgs.b_description}" />
</f:facet>
Hier sollte was stehen, um alle
Descriptions aus B anzuzeigen. <----------------------
</h:column>
....

Ich bin mit meinen Gedanken am Ende und weiß nicht mehr weiter.

Viele Dank für eure Hilfe und einen schönen Tag

Gruss
Michael
 
D

DeoXMAN

Hallo Leute!

ich hab ein Problem und brauche eure fachliche Kompetenz zur Lösung.

Folgendes:
Ich hab ein Object A mit einen Set an weiteren Objects B und wird als Liste
per Hibernate aus der DB geladen.

class B {
int id;
String description;
//getter and setter

}

class A{
int id;
String description;
Set<B> listOfBs;
//getter and setter

}

In der JSP mit JSF-Tags kommt <h:dataTable zum Einsatz um eine komplette
Liste darzustellen. Ich bin soweit, dass alle Properties aus A angezeigt
werden, aber mein Problem ist die Darstellung aller B Elemente (Set). Bis
jetzt erhalte ich nichts zurück oder eine Fehlermeldung. Die Objekte werden
von Hibernate komplett eingelesen. Ein Problem mit Lazy-Loading gibt es
nicht.

<h:dataTable ....>
<h:column>
<f:facet name="header">
<h:eek:utputText value="#{msgs.a_description}" />
</f:facet>
<h:eek:utputText value="#{record.description}" />
</h:column>
...
<h:column>
<f:facet name="header">
<h:eek:utputText value="#{msgs.b_description}" />
</f:facet>
Hier sollte was stehen, um alle
Descriptions aus B anzuzeigen. <----------------------
</h:column>
...

Ich bin mit meinen Gedanken am Ende und weiß nicht mehr weiter.

Viele Dank für eure Hilfe und einen schönen Tag

Gruss
Michael


This group is english languaged, so i suggest you should try to use
english ;)
 
M

Michael Plate

Hello DeoXMAN,

thank you for your special note. :)

here the translation of my previous contribution:

i have a problem and need your help.

follow:
i had a object A with a set of objects B and that will be loaded completely
by hibernate. hibernate presents a collection of objects A.

class B {
int id;
String description;
//getter and setter
}

class A{
int id;
String description;
Set<B> listOfBs;
//getter and setter
}

my jsp page with JSF tags using <h:dataTable for illustrate the collection
comes from hibernate. at moment i can show all description from object A. i
can't access or show the description of object b on my screen. an problem
with lazy-loading by hibernate are solved and the objects will loading
completely. i'm an newbie at JSF and my main problem is finding the correct
statement for present 'description' of B's.

the following table should appeared:
---------------------------------
| a1.description | b1.description |
| a1.description | b2.description |
---------------------------------
| a2.description | b1.description |
---------------------------------

<h:dataTable ....>
<h:column>
<f:facet name="header">
<h:eek:utputText value="#{msgs.a_description}" />
</f:facet>
<h:eek:utputText value="#{record.description}" />
</h:column>
...
<h:column>
<f:facet name="header">
<h:eek:utputText value="#{msgs.b_description}" />
</f:facet>
// statements for show descriptions
from object B . <----------------------
</h:column>
...

i haven't an idea and can't find a solution for my problem.

thank you very much for answers.

best regards
Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top