• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSF and trying to display a resultset

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all, This is my first post here. Been looking around and I am hoping you can help a java greenhorn. Not really a greenhorn but its been a long time so i am trying to get back into the scene.

So i am playing around with JSF and I am trying to display a resultset on a page. I have the db conn working, the query is running and the code to 'print' the data into a table is working but it displays all the tags on the page instead of the table with the data inside.

This is what you see on the page.
Hello from Facelets <table border=1><tr><th>ID<th>FirstName<th>LastName<th>UserID<th>Email<th>ShiftLead</tr><tr><td>1<td>Chuck<td>Barnes<td>xxxxxxx<td>xxxx@xxx.com<td>1</tr></table>

this is the index.xhtml

I assuming the issue is with the xhtml file.



help please
 
Chuck Barnes
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
found it

 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's pretty raw. Any reason why you're not using the JSF datatable control, instead? It can use a JDBC resultset as one of its model options.

In general, I don't recommend having program logic generate HTML. It strains the separation between Model, View, and Controller, it can be a real pain to track down where individual parts of the UI came from, and changes to page layout require programming as opposed to HTML skills.
 
Chuck Barnes
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:That's pretty raw. Any reason why you're not using the JSF datatable control, instead? It can use a JDBC resultset as one of its model options.


Did not know of it. School me.


Tim Holloway wrote:
In general, I don't recommend having program logic generate HTML. It strains the separation between Model, View, and Controller, it can be a real pain to track down where individual parts of the UI came from, and changes to page layout require programming as opposed to HTML skills.



I'll keep that in mind
 
Tim Holloway
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chuck Barnes wrote:

Tim Holloway wrote:That's pretty raw. Any reason why you're not using the JSF datatable control, instead? It can use a JDBC resultset as one of its model options.


Did not know of it. School me.



Rule #1 in JSF. Anytime you do something that requires hard work and/or references to any javax.faces classes except for the datamodel ones, you're probably doing it wrong.

You may find this reference handy. I do,

http://www.exadel.com/tutorial/jsf/jsftags-guide.html
reply
    Bookmark Topic Watch Topic
  • New Topic