aspose file tools*
The moose likes JSF and the fly likes JSF and trying to display a resultset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF and trying to display a resultset" Watch "JSF and trying to display a resultset" New topic
Author

JSF and trying to display a resultset

Chuck Barnes
Ranch Hand

Joined: Aug 10, 2010
Posts: 37
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

Joined: Aug 10, 2010
Posts: 37
found it

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16142
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Chuck Barnes
Ranch Hand

Joined: Aug 10, 2010
Posts: 37
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

Joined: Jun 25, 2001
Posts: 16142
    
  21

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF and trying to display a resultset