• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF and trying to display a resultset

 
Chuck Barnes
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
found it

 
Tim Holloway
Saloon Keeper
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic