• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Setting up a JSF project with data tables

 
Ranch Hand
Posts: 421
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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">
<h:outputText value="This is 'dataTable' demo" />
</f:facet>

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

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

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

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

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

<f:facet name="footer">
<h:outputText 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
 
Saloon Keeper
Posts: 26019
186
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
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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
It's a beautiful day in this neighborhood - Fred Rogers. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic