• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Loading DB data when web app context initialized

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've asked this question previously and I think that I phrased it badly.
So, here goes again.
This web app's welcome page contains a single <h:commandLink> that routes to a page upon which I need to display a list of db rows.
I retrieve the rows using a listener class defined in the web.xml file. I get the rows ok and I assign the rows (as a List object) to a managed bean - patientBackingBean - that has a property - patientList -that corresponds to the list.
However, when I use <h:dataTable in my jsp I see no results. The datatable tag looks like this-

><h:dataTable id="patlistid"
first="0"
rows="0"
value="#{patientBackingBean.patientList}"
var="patlist"
rowClasses="list-row-odd,list-row-even"
headerClass="table-header"
width="75%">

<h:column>
<f:facet name="header">
<h:outputText value="Select"/>
</f:facet>
<h:selectBooleanCheckbox onclick="this.form.submit();" />
</h:column>

<h:column rendered="#{patient.patientId}">
<f:facet name="header">
<h:outputText value="#{res[\'patient.patientid\']}"/>
</f:facet>
<h:outputText value="#{patlist.patientId}"/>
</h:column>

and so on for each column.

I know that FacesContext is initialized at this point.
Any one have an answer?
TIA...
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use an application scoped managed bean instead of the listener and inject it as managed property of the request scoped bean which you use in your table.
 
Bruce Riches
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, it turns out that that was what I was doing finally, just had made a mistake in implementing it.
Thanks anyway - at least I now know that that's the way to do this.
 
reply
    Bookmark Topic Watch Topic
  • New Topic