• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting up a JSF project with data tables

 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello I am trying to do this:

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>

<f:view><html><body>
<h:form>
<br><br><br>
<h:dataTable id="dt1" value="#{TableBean.perInfoAll}" var="item" bgcolor="#F1F1F1" border="10" cellpadding="5" cellspacing="3" first="0" rows="4" width="50%" dir="LTR" frame="hsides" rules="all" summary="This is a JSF code to create dataTable." >

<f:facet name="header">
<hutputText value="This is 'dataTable' demo" />
</f:facet>

<h:column>
<f:facet name="header">
<hutputText value="id" />
</f:facet>
<hutputText value="#{item.id}"></hutputText>
</h:column>

<h:column>
<f:facet name="header">
<hutputText value="name"/>
</f:facet>
<hutputText value="#{item.name}"></hutputText>
</h:column>

<h:column>
<f:facet name="header">
<hutputText value="phone"/>
</f:facet>
<hutputText value="#{item.phone}"></hutputText>
</h:column>

<h:column>
<f:facet name="header">
<hutputText value="city"/>
</f:facet>
<hutputText value="#{item.city}"></hutputText>
</h:column>

<h:column>
<f:facet name="header">
<hutputText value="pin"/>
</f:facet>
<hutputText value="#{item.pin}"></hutputText>
</h:column>

<f:facet name="footer">
<hutputText value="The End" />
</f:facet>

</h:dataTable><br><br>

</h:form>
</body></html></f:view>


this does not work for me because I do not have the classpath environment variable set up correctly. Can someone help me with detailed instructions on how to do this? I know where to find the environment variables, however, I am not sure if they should be named CLASSPATH and also what should be in the value for the CLASSPATH variable.

Thanks
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17989
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Helpful hint: use the "Code" button to get the message editor to wrap special tags around your code/xml that will keep it from getting mangled.

I don't have any idea how CLASSPATH is supposed to apply to what you're asking, however. A dataTable works by referencing a DataModel object that manages the rows to be displayed. The DataModel object is a property of a backing bean.

Normally, the datamodel object is constructed by the backing bean and backing beans are (by definition) part of the classpath of a JSF app. So no special peeking into environments or whatever is required. Not that it's a good idea for webapps to use environment variables anyway.
 
Michele Smith
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello again, this is my first time working with JSF. ITo review what we were saying the last time you wrote to me was this:

The class path is set to where ever the jsf jar files are located.
Its used in a web application so the jar files are going to be in
the application_name\WebRoot\web-inf\lib directory.

My setup is now:
root path to jsf-api.jar;
root path to jsf-impl.jar;

now I am having a different problem. Even though that is all squared away, I cannot create a JSF file:



and have no problems with the following Bean:

TableBean is the name of this Bean:





Please help me get pointed in the right direction to create a JSF page so that I can run this code with the bean -- Thanks very much!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic