| Author |
Setting up a JSF project with data tables
|
Michele Smith
Ranch Hand
Joined: Oct 27, 2010
Posts: 298
|
|
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">
<h utputText value="This is 'dataTable' demo" />
</f:facet>
<h:column>
<f:facet name="header">
<h utputText value="id" />
</f:facet>
<h utputText value="#{item.id}"></h utputText>
</h:column>
<h:column>
<f:facet name="header">
<h utputText value="name"/>
</f:facet>
<h utputText value="#{item.name}"></h utputText>
</h:column>
<h:column>
<f:facet name="header">
<h utputText value="phone"/>
</f:facet>
<h utputText value="#{item.phone}"></h utputText>
</h:column>
<h:column>
<f:facet name="header">
<h utputText value="city"/>
</f:facet>
<h utputText value="#{item.city}"></h utputText>
</h:column>
<h:column>
<f:facet name="header">
<h utputText value="pin"/>
</f:facet>
<h utputText value="#{item.pin}"></h utputText>
</h:column>
<f:facet name="footer">
<h utputText 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
Joined: Jun 25, 2001
Posts: 14456
|
|
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.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
Michele Smith
Ranch Hand
Joined: Oct 27, 2010
Posts: 298
|
|
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!
|
 |
 |
|
|
subject: Setting up a JSF project with data tables
|
|
|