Decorating Pojos in a h:dataTable

Hi!
I have a quite simple question (hopefully).
When I use a h:dataTable to render a collection of domain objects, I will pass on a collection to the control, which will iterate it and assign it to var for each line of the table.
But I would need to use a Decorator to display my domain object properly in the table, for example to display a text for a key constant.
Would I have to make a copy of my collection which contains instances of decorator objects linking to the actual domain objects or is there any means to define a decorator to be applied to the domain objects?
Regards,
Torsten

You can play with the rendered attribute.<h:dataTable rendered="#{!empty myBean.data}">
</h:dataTable>
<h:outputText value="No records found." rendered="#{empty myBean.data}" />Or use facesmessages.

Similar Messages

  • COMMAND BUTTON NEEDS TO BE CLICKED TWICE TO SAVE VALUES

    Hello,
    I have a problem that I'm pretty much spent hours trying to fix but failed to do so.
    I have a jsf page with a datatable bound to a component.
    I have updatable fields inside the table and a button below to save changes to the table.
    When I make a change the first time, and then hit the button, i get the action, and I save the value with no problems.
    However if right after it re-renders, I make another change in the table , and save button again it won't invoke the backing bean save method.
    The setter for the datatable binding property does get invoked however, it disregards the changes i just made to the table.....
    If i make changes for the third time...and hit save...it works...
    All my backing beans are request scope
    any clues???? i appreciate your help!!
         public void save(ActionEvent e) {
              log.debug("Im entering save user");
              currentSession.setCurrentSession(client);
              FacesContext.getCurrentInstance().renderResponse();
              organicManager.saveAppUsers(client, (List)appUsersTable.getValue());
              appUsersTable.setValue(new ArrayList(organicManager.getAppUsers(client)));
    <t:commandLink  actionListener="#{appUsersBean.save}" rendered="#{!appUsersBean.adding}">
         <h:outputText value="save" style="font-weight:bold;font-size:14px;text-decoration:none"/>
    </t:commandLink>
    <t:dataTable
    binding="#{appUsersBean.appUsersTable}"
              id="appUsersTable"
              var="userRow"
              style="font-family:arial;font-size:11px;"
              rendered="#{!appUsersBean.adding}"
              bgcolor="lightcyan"
              preserveDataModel="true"
         >
         <h:column>
              <f:facet name="header">
                   <h:outputText value="Username"/>
              </f:facet>          
              <h:inputText value="#{userRow.username}" readonly="true"  style="font-family:arial;font-size:10px" />
         </h:column>
         <h:column>
              <f:facet name="header">
                   <h:outputText value="FirstName"/>
              </f:facet>          
              <h:inputText value="#{userRow.firstName}" maxlength="50"  style="font-family:arial;font-size:10px" />
         </h:column>
         <h:column>
              <f:facet name="header">
                   <h:outputText value="LastName"/>
              </f:facet>          
              <h:inputText value="#{userRow.lastName}" maxlength="50" style="font-family:arial;font-size:10px" />
         </h:column>

    Yes.
    When I click the Close Window button, the Confirm close dialog window closes . . . but there is another one right behind it. I have to click the Close Window button again, and only then does the Firefox browser window close.
    A couple of factors are involved:
    1. I have "Warm me when I have multiple tabs" set to on.
    2. Two or more tabs must be open in the Firefox window
    3. I have at least two Firefox browser windows already open (not sure about this one, yet)
    I thought before that it was necessary to have a dialogue box from a different program open, but this is not necessary for the bug to appear.
    Thank you for your help!

  • Non-sequential IDs assigned using sequence="ID" on PrimaryKey

    Hello,
    I've seen some people asking something similar but I can't get this thing to work and it's driving me crazy. I'm using je-3.2.23 BTW.
    I have this simple class:
    * SYSADM.java
    * Created on 26 de junio de 2007, 09:29 AM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package haven;
    import com.sleepycat.persist.model.Entity;
    import com.sleepycat.persist.model.PrimaryKey;
    * @author Mario
    @Entity
    public class SYSADM extends Usuario{
    private boolean root;
    @PrimaryKey(sequence="ID")
    private long id;
    /** Creates a new instance of SYSADM */
    public SYSADM() {
    /** Creates a new instance of SYSADM from parameters */
    public SYSADM(boolean root,long id, String loginName, String password, String nombre, String apellido, String email) {
    super(loginName, password, nombre, apellido, email);
    setRoot(root);
    //setId(id);
    /** Creates a new instance of SYSADM from a VOSYADM */
    public SYSADM(VOSYSADM voSYSADM) {
    super(voSYSADM.getLoginName(),voSYSADM.getPassword(),
    voSYSADM.getNombre(),voSYSADM.getApellido(),voSYSADM.getEmail());
    setRoot(voSYSADM.isRoot());
    //setId(voSYSADM.getId());
    public VOSYSADM getVOSYSADM() {
    return new VOSYSADM(this.isRoot(),this.getId(),this.getLoginName(),this.getPassword(),
    this.getNombre(),this.getApellido(),this.getEmail());
    public boolean isRoot() {
    return root;
    public void setRoot(boolean root) {
    this.root = root;
    public long getId() {
    return id;
    public void setId(long id) {
    this.id = id;
    and when I add records to the database using DPL I get ids like 1,101,201... and so on.
    I've looked at all the examples and tested them myself and I get the same behavior from all the classes I test.
    Plus all the tutorials and materials say that this is plain simple... let me quote from PrimaryIndex:
    " Employee employee;
    employee = new Employee("Jane Smith");
    primaryIndex.putNoReturn(employee); // Inserts an entity
    assert employee.id == 1;
    employee = new Employee("Joan Smith");
    primaryIndex.putNoReturn(employee); // Inserts an entity
    assert employee.id == 2; "
    I don't get... may be I'm plain dumb... should've ask that first to myself... I'm getting desperate here people... really!
    Anyway... any help is much appreciated.
    Regards to all,
    Mario

    First of all many thanks for your feedback... it's
    really encouraging in times of desperation to find
    somebody out willing and actually helping you! You're welcome!
    This is good. I'm aware of how RDBMS are integrated
    in the AS. Basically you need the driver and the
    connection to the database. For DBD JE I have made a
    simple test and I can persist objects from a web
    application in the AS. I simply open the environment
    that points to a directory in the file system. I
    suppose that as long as that directory is accessible
    through the network it should be fine. Is this
    correct?That''s correct. However, I strongly recommend that the Environment directory be on a local disk. There are problems with using NFS, see:
    http://www.oracle.com/technology/products/berkeley-db/faq/je_faq.html#1
    The question of scalability arises. As far as I read
    DBD C is the number one embeddable OpenSource
    Database out there. So I assume the same would apply
    for BDB JE some day (more even once it gets HA). How
    scalable is BDB JE? The limitation seems to be the
    available space in the machine where the filesystem
    is located? Does the filesystem have to the same
    where the AS is installed?It sounds like you're asking about data size scalability, not processor scalability. Yes, the limitation is the amount of file storage available, via a single directory, from the process that embeds JE. JE uses the standard java.io package for creating and accessing log files, so any hardware and file system that works under that API will work, as long as file locking is supported as mentioned in the FAQ above. JE creates numbered log files in sequence from 00000000.jdb to FFFFFFFF.jdb, and you can configure the size of the files. The default size is 10 MB.
    Ok I 'll look into it. Specialy into what a "Service"
    is. Off the top of my head I guess that by service
    you are referring to a stateless ejb implementing the
    Singleton pattern so you have only one instance
    running at all times, that embeds all database
    interactions, opens the environment at creation time,
    give data-accessors and thus handles all access to
    the database. Exactly.
    Should I open all indexes in the
    Singleton at creation time as well and simply get
    data-accessors to to perform read/write operations?Yes, that's what I recommend. See:
    http://www.oracle.com/technology/products/berkeley-db/faq/je_faq.html#12
    Ok we willhave to wait then. One of the questions I
    received about BDB JE is why a JE when you have the C
    version with a Java API? I guess it's related to
    being written in Java (portability-wise), it runs in
    the same JVM and it's 100% Java codeYes, this is the primary reason. A pure Java library is easier to deploy, test and debug than a C-based library, especially if you target multiple platforms. And the product can be optimized for the Java platform.
    and that it
    incorporates the DPL much in the way JPA works to
    have a closer integration. Am I correct?The DPL is only available for the JE product today, but it may be available for the C product in the future, since it is implemented on top of the base Java API that is common to both products.
    Also, while the JE product has similar functionality to the C product, it uses a different internal architecture. JE uses a log structured storage system rather than a traditional page-based storage system; this is better for writing (disk head moves less) but worse for fetching records that are not in cache (disk head moves more). JE also uses record locking rather than page locking; this improves concurrent access but uses more memory for locks.
    See "Berkeley DB Java Edition Architecture" here:
    http://www.oracle.com/technology/products/berkeley-db/je/index.html
    Last but not least. Portability-wise we are using DAO
    to persist and in the DAOs we perisist the objects.
    My logic is that by decorating POJOs with BDB JE
    annotations i can use DAO to persist in DB JE, any
    other persistency type including text, dbf, RDBMs
    using an ORM (without JPA), or creating a separate
    set of classes decorated with JPA annotations (though
    I would stick with ANSI SQL if I could). Do you see
    this as correct? Would you reccomend using DAO at all
    with Berkeley?Yes, a DAO is a good idea when you need to target multiple storage mechanisms. And the DPL does not meet this need, because it can only be used for Berkeley DB JE.
    If you need an API that works very well for Berkeley DB (JE and C products), plus relational DBs, then I strongly recommend Carbonado, an open-source framework from Amazon:
    http://carbonado.sourceforge.net/
    Mark

  • JSF + Hibernate - non- persistant objects in a dataTable

    This is more of a conceptual question, concerning creating a dataTable from a list.
    I have a User-with-Projects 1:M relationship. Projects are obligatory and not obligatory. I have a user with one compulsory project and a 5 not obligatory. The point is that the 6 projects should be visible in the UI under a h:dataTable component while each inputText from the dataTable should be mapped to beans. The obligatory project is always persisted in the DB, but the others are persisted only if data is inserted in the UI.
    So my question is:
    How could I form a dataTable, including the 6 project, and check if a data is inserted in the not-compulsory ones?
    I tried to create a User object with 6 Project entities (pojo classes), the first one is persisted in the DB and the others are not. This way I had a problem with the lack of ProjectID in the 5 remaining projects (since they are not a part of the DB). The issue could be elsewhere, but that's a rock I hit.
    I'll also try creating a ProjectBean with 6 project, on a form submit checking each of the rows for a new data. If user input is available, the project would be inserted in the table. I could also try using an actionListener to check for the input, but I'm not quite sure of getting the correct row I need when the listener is active.
    Is there any elegant way of mapping the projects and insert the not- obligatory only if they contain data?
    Thanks in advance,
    nofearinc

    >
    Straightforward enough: check if the values aren't null ;) You can also consider to add a valueChangeListener to one or more fields. It would only be fired if the field's value has been changed.
    Thanks for the comment, It was just weird for me how to have a User with a List<Project> and not all of the projects are persisted :) It seems a little strange for me as a realization and I assume that Hibernate would also be confused after session saving. That's why I think that I'll need a list of backing beans which would lately be transfered to entities if data is persisted (just being curious if there is more easy and elegant way to do that).
    The valueChangeListener would be called after any data is inserted in the row - it's possible that a user could go wrong and edit a field, then erase it again. So I have to insert in the DB only on a form submit (less DB activity).
    I'll try this getRowData() method tomorrow, it seems like a reasonable solution if I could use it in my case (dataTable with list of projects and get each row as a particular project).
    Thanks again for the reply, I'd be happy to hear any ideas on the subject ;)
    nofearinc

  • Need advice for dispalying multiple rows with datatable.

    Hi All,
    We have to design a conference booking search form which contains nX48 table.
    n -> indicates the conference rooms and 48 are the time slots(30 mins gap).
    While booking a conference room user enteres from time and to-time and from and to dates.
    In our search form, user searches with in the range of dates and times.
    We give a option for user to view according to date wise or room wise.
    Now main prblm is that we are capturing from and to times but how do we represent in data table.
    out of 48 columns assume only 4 slots are booked i.e 1200 hrs to 1400 hrs. so we need to display an image in that columns and up on clicking on that cell we have to produce data regarding that booking.
    In our pojo we have to and from time variables , but how can we display in datatable..should have to take a 48 column pojo.., if so how can I get the data at intersection point?
    Please do help me...
    Regards,
    Kranthi Kiran

    You could certainily create a 48 or 96 column grid. I would assume a simple "bar" image would go into that grid. You can create a method that gets called to determine if the image is rendered or not. Use a stylesheet (inline style) to set the width of the grid.
    While making a table with 48 column definitions is somewhat messy it is certainly no harder than cut and paste. The messy part is how to implement the boolean getter (DI) call to determine if a cell image is rendered as this would require 48 or 96 unique method definitions (one for each time slot). If you are will to do this then the solution is straight forward with a table.
    As for clicking on the image cell that is not an issue and easily handled.
    You have not mentioned what component suite you want to use. May I recommend that you take a look at Apache Trinidad (MyFaces project) or Oracle's ADF offering.
    If not you could do this with two tag iterators (e.g. tr:iterator) but fussing with trying to make sure you get cell alignment might be hard to do since you would not have a "master" grid in which you would be rendering your data.
    Could also write your own component ... but suspect you don't want to go there.
    You will find that they provide a robust table implementation that also supports the concept of "details", sort of a drill down capability that you can add to see additional information associated with a summary line in a table.

  • Hiding exceeded data in h:dataTable columns

    hi,
    my requirement is I have to display some data in dataTable and I need to put fixed height for the columns.if the data in that column exceeds then the data should hide and onmouseover one tooltip should come showing the exceeded data.
    but the jsf data table is not hiding the data at all.I have given width and height for that column using css but it is showing the data completely.
    please tell me how can I do this one.

    Hi,
    I tried using overflow property also..but i is not working for me..I am sending my code also
    <h:dataTable id="popresults"
    value="#{popsearch.popList}"
    var="pop"
    columnClasses="name"
    border="0" rowClasses="standardTable_Row2,standardTable_Row1"
    headerClass="DHTMLSuite_tableWigdet_headerCellDown_searchlist" style="vertical-align:middle;" styleClass="tableList_search" width="100%" cellpadding="1" cellspacing="0">
              <h:column>
    <f:facet name="header">
    <h:outputText value="POP Id" style="text-decoration:none;color:black;font-weight:bold;"/>
         </f:facet>
              <h:commandLink id="id"
                             action="#{popdetails.getPOPDetails}"
                             actionListener="#{popsearch.selectPOP}" onmouseover="ddrivetip('#{pop.id}')" onmouseout="hideddrivetip()">
                   <h:outputText value="#{pop.id}" style="text-decoration: none;color: black;border-bottom: 1px solid black;" />
                   <f:param id="popId"
                             name="popId"
                             value="#{pop.id}" />
                   <f:param id="discriminator"
                             name="discriminator"
                             value="#{pop.discriminator}" />
              </h:commandLink>
         </h:column>
         <h:column>
    <f:facet name="header">
         <h:panelGrid columns="2">
         <h:commandLink value="Provider Id" action="#{popsearch.getPopResults}" actionListener="#{popsearch.sortPidDataList}" style="text-decoration:none;color:black;font-weight:bold;">
    <f:attribute name="providerid" value="providerID"/>
         </h:commandLink>
         <h:graphicImage id="pidarrowup" url="#{popsearch.popimg}" rendered="#{popsearch.pidren}"/>
    </h:panelGrid>
    </f:facet>
    <h:outputLabel value="#{pop.providerID}" onmouseover="ddrivetip('#{pop.providerID}')" onmouseout="hideddrivetip()"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="Modem Phone"/>
    </f:facet>
    <h:outputLabel value="#{pop.modemPhone}" onmouseover="ddrivetip('#{pop.modemPhone}')" onmouseout="hideddrivetip()"/>
    </h:column>
         <h:column>
    <f:facet name="header">
    <h:panelGrid columns="2">
         <h:commandLink value="POP Class" action="#{popsearch.getPopResults}" actionListener="#{popsearch.sortPclassDataList}" style="text-decoration:none;color:black;font-weight:bold;">
    <f:attribute name="popClass" value="discriminator"/>
         </h:commandLink>
                        <h:graphicImage id="pclassarrowup" url="#{popsearch.popimg}" rendered="#{popsearch.pclassren}"/>
    </h:panelGrid>
    </f:facet>
    <h:outputText value="Broadband" rendered="#{pop.discriminator eq 'B'}">
    </h:outputText>
    <h:outputText value="Dial" rendered="#{pop.discriminator eq 'D'}">
    </h:outputText>
    </h:column>
         <h:column>
    <f:facet name="header">
    <h:outputText value="Location" />
    </f:facet>
    <h:outputLabel value="#{pop.siteAddress}" rendered="#{pop.discriminator eq 'B'}" onmouseover="ddrivetip('#{pop.siteAddress}')" onmouseout="hideddrivetip()"/>
    </h:column>
    </h:dataTable>
    and css is
    .name {
    width: 25px;
    text-align: left;
    nowrap:true
    white-space:nowrap
    overflow:hidden
    please tell me If I missed any thing.

  • Datatable outputext parameter

    I have a t:datatable that shows severalfields of a pojo. There's a requirement to show additional data from that bean in a 'flattened' way:
    The pojo has a Set of other objects, say, a Person has a Set of Pets and every Person in the system has at least a cat and a dog for pet.
    The datatable needs to show the name of the person, cat and dog in single row.
    <h:column headerClass="columnHeader" footerClass="columnFooter">
      <f:facet name="header">
        <h:outputText value="Cat's name" />
      </f:facet>
      <h:column>
        <h:outputText value="#{person.pets('Cat').name}" />
      </h:column>
    </h:column>I've tried to above, which doesn't work because JSF doesn't accept parameters that way. And I can't use an attribute because I don't know how to solve the binding issue. Is there an alternative next to polluting the pojo (adding explicit get methods).
    dave

    You can abuse a map for this purpose. If you make pets a Map (which might mean you need a nasty ORM query or manual translation of a collection type) you could pose your EL like:
    <h:outputText value="#{person.pets['Cat'].name}" />But since you apparently hardwire the key in the view, you could just as easily create specialized getter methods to retrieve the name of known objects.
    public void getNameOfCat(){
      // code to lookup the cat object and return its name
    }I don't see why you call that "polluting", it makes the code clean and simple IMO.

  • Using pojos and jsf

    Hi guys
    I am trying to connect Pojos with jsf. I 've found that the problem is in the ejbs.
    I am using eclipse 3.1.1, jboss-4.0.4RC1 and myfaces.
    I think the application doesn't inicialize the context. Because all class work with servlet. I already have tested it.
    The error shows me
    0:20:29,981 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
    javax.faces.el.EvaluationException: Cannot get value for expression '#{PropiedadesBean.allProperties}'
         at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:397)
         at javax.faces.component.UIData.getValue(UIData.java:779)
         at javax.faces.component.UIData.createDataModel(UIData.java:545)
         at javax.faces.component.UIData.getDataModel(UIData.java:534)
         at javax.faces.component.UIData.getRowCount(UIData.java:103)
         at org.apache.myfaces.renderkit.html.HtmlTableRendererBase.encodeInnerHtml(HtmlTableRendererBase.java:124)
         at org.apache.myfaces.renderkit.html.HtmlTableRendererBase.encodeChildren(HtmlTableRendererBase.java:94)
         at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:319)
         at javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:343)
         at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:251)
         at org.apache.myfaces.taglib.UIComponentBodyTagBase.doEndTag(UIComponentBodyTagBase.java:55)
         at org.apache.jsp.paginas.propiedades_jsp._jspx_meth_h_dataTable_0(org.apache.jsp.paginas.propiedades_jsp:196)
         at org.apache.jsp.paginas.propiedades_jsp._jspx_meth_h_form_0(org.apache.jsp.paginas.propiedades_jsp:145)
         at org.apache.jsp.paginas.propiedades_jsp._jspx_meth_f_view_0(org.apache.jsp.paginas.propiedades_jsp:113)
         at org.apache.jsp.paginas.propiedades_jsp._jspService(org.apache.jsp.paginas.propiedades_jsp:78)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
         at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
         at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:693)
         at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:660)
         at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:49)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
         at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
         at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
         at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
         at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
         at java.lang.Thread.run(Unknown Source)
    Caused by: javax.faces.el.EvaluationException: org.jboss.jose.db.PropiedadesBean
         at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:78)
         at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:532)
         at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
         at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:378)
         ... 77 more
    Caused by: javax.faces.el.EvaluationException: Bean: org.jboss.jose.db.PropiedadesBean, property: allProperties
         at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:404)
         at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:71)
         ... 80 more
    Caused by: java.lang.reflect.InvocationTargetException
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:400)
         ... 81 more
    Caused by: java.lang.NullPointerException
         at org.jboss.jose.db.PropiedadesBean.getAllProperties(PropiedadesBean.java:71)
         ... 86 more
    10:20:30,001 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
    javax.faces.FacesException: Cannot get value for expression '#{PropiedadesBean.allProperties}'
         at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421)
         at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
         at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:693)
         at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:660)
         at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:49)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
         at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
         at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
         at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
         at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
         at java.lang.Thread.run(Unknown Source)
    Caused by: org.apache.jasper.JasperException: Cannot get value for expression '#{PropiedadesBean.allProperties}'
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
         ... 50 more
    10:20:30,022 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
    javax.faces.FacesException: Cannot get value for expression '#{PropiedadesBean.allProperties}'
         at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421)
         at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
         at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:693)
         at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:660)
         at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:49)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
         at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
         at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
         at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
         at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
         at java.lang.Thread.run(Unknown Source)
    Caused by: org.apache.jasper.JasperException: Cannot get value for expression '#{PropiedadesBean.allProperties}'
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
         ... 50 more
    10:20:30,032 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
    javax.faces.FacesException: Cannot get value for expression '#{PropiedadesBean.allProperties}'
         at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421)
         at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
         at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
         at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
         at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
         at java.lang.Thread.run(Unknown Source)
    Caused by: javax.servlet.ServletException: Cannot get value for expression '#{PropiedadesBean.allProperties}'
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:693)
         at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:660)
         at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:49)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
         ... 25 moreMy jsf is that
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>propiedad</title>
    </head>
    <body>
    <f:view>
         <h:form id ="Properties">
              <h:dataTable id ="Propiedades" value="#{PropiedadesBean.allProperties}" var="prop" border="1">
                   <h:column>
                        <f:facet name="header">
                             <h:outputText value="Referencia"></h:outputText>
                        </f:facet>
                        <h:outputText value="#{prop.referencia}"></h:outputText>
                   </h:column>
                   <h:column>
                        <f:facet name="header">
                             <h:outputText value="Habitaciones"></h:outputText>
                        </f:facet>                    
                        <h:outputText value="#{prop.nHabitaciones}"></h:outputText>
                   </h:column>
              </h:dataTable>
         </h:form>
    </f:view>
    </body>
    </html>My bean is that
    import java.io.Serializable;
    import java.util.List;
    import java.util.ArrayList;
    import javax.ejb.Local;
    import javax.ejb.Remote;
    import javax.ejb.Stateless;
    import javax.faces.context.FacesContext;
    import javax.faces.el.ValueBinding;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    import javax.persistence.Query;
    @Stateless (name="propiedadesLocal")
    public class PropiedadesBean implements LocalPropiedades, Serializable {
         @PersistenceContext (unitName="test")
         private EntityManager em;
         public List <Propiedad> getAllProperties() {
              ArrayList<Propiedad> propiedades = new ArrayList<Propiedad>();
              ValueBinding beanValueBinding = facesContext.getApplication().createValueBinding("#{propiedadesBean.allProperties}");*/
              Query q = em.createQuery("From propiedades");
              for (Object o: q.getResultList()) {
                   propiedades.add((Propiedad) o);
              return propiedades; 
    }this statement doesn't work
    Query q = em.createQuery("From propiedades");
    When I put a checkpoint. I see the em variable is null.
    Here I've got only a function returns a ArrayList. This class implements the business logic.
    My another class implements the pesistence is that.
    package org.jboss.jose.db;
    import javax.persistence.*;
    import java.util.*;
    import java.io.Serializable;
    import javax.persistence.*;
    import javax.persistence.Id;
    @Entity
    @Table(name="propiedades")
    public class Propiedad implements Serializable{
         private int referencia;
         private double precio1;
         private String referenciaCliente;
         private int nHabitaciones;
         private int cuartosDeBa�o;
         private Empleado empleado;
         //static final long serialVersionUID = 1L;;
         public Propiedad(){};
         public int getCuartosDeBa�o() {
              return cuartosDeBa�o;
         public void setCuartosDeBa�o(int cuartosDeBa�o) {
              this.cuartosDeBa�o = cuartosDeBa�o;
         public int getNHabitaciones() {
              return nHabitaciones;
         public void setNHabitaciones(int habitaciones) {
              nHabitaciones = habitaciones;
         public double getPrecio1() {
              return precio1;
         public void setPrecio1(double precio1) {
              this.precio1 = precio1;
         @Id //(generate = GeneratorType.AUTO)
         @GeneratedValue
         @Column (name = "Referencia")     
         public int getReferencia() {
              return referencia;
         public void setReferencia(int referencia) {
              this.referencia = referencia;
         public String getReferenciaCliente() {
              return referenciaCliente;
         public void setReferenciaCliente(String referenciaCliente) {
              this.referenciaCliente = referenciaCliente;
         //@JoinColumn (name = "idEmpleado")
         @ManyToOne
         public Empleado getEmpleado() {
              return empleado;
         public void setEmpleado(Empleado empleado) {
              this.empleado = empleado;
    The servlet that works
    package org.jboss.jose.web;
    import javax.servlet.http.HttpServlet;
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    //import java.io.IOException;
    import org.jboss.jose.db.*;
    //import org.jboss.ejb.PropiedadesBean;
    public class PropiedadServlet extends HttpServlet {
         private LocalPropiedades propiedadesBean;
         private EmpleadosBean empleadosBean;
         protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {          
              this.mostrarPropiedades(req, resp);
         public void init() throws ServletException {
              try {
                   Context context = new InitialContext();
                   this.propiedadesBean = (LocalPropiedades) context.lookup("inmovil/propiedadesLocal/local");
                   this.propiedadesBean.addEmpleadoPropiedad("jose",1,"1",1000.00,"1000",1,1);          
              } catch (NamingException e) {
                   // TODO Auto-generated catch block
                   System.out.println(e.getMessage());
    //               e.printStackTrace();
         private void mostrarPropiedades(HttpServletRequest req, HttpServletResponse resp) throws ServletException ,IOException {
              PrintWriter out = resp.getWriter();
              for (Propiedad prop: this.propiedadesBean.getAllProperties()) {
                   out.p                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

    I think that I don't load. But I don't know where I write the below line.Than it's clear that you'll get a NullPointerException.
    But I don't know where I write the below line.
    Context context = new InitialContext();
    this.propiedadesBean = (LocalPropiedades)
    context.lookup("inmovil/propiedadesLocal/local");Whenever you need it. For example within an ActionHandler which loads the bean
    and makes a DTO Object (Bean used by the JSF Page) available for the JSF Page.
    But where you actually have to load the Bean depends on your design.
    andi

  • How to get only the changed rows in h:dataTable

    Hi,
    I am very new in jsf technology.
    For our application, I need to process only the changed rows in the jsf datatable in managed bean.
    User may also enter new rows.We have to consider this also.
    Pls post ur suggession as soon as possible.This is urgent.This will be best if someone can post me some code snippets.
    Thanks
    -S

    As klejs said, set the valueChangeListener attribute to each of the input fields. Have a method in your backing bean which would
    1) get the index from the component id
    2) get the object and the above index from ArrayList
    3) check if the old Value is different from the new value. If yes, set some boolean flag in that object to true indicating that the row is modified.
    Sample code below. Please feel free to add checks if you need.
         public void updateDirtyFlag(ValueChangeEvent valueChangeEvent){
             if(valueChangeEvent.getOldValue()==null && valueChangeEvent.getNewValue()==null){
                     return;
             if(valueChangeEvent.getComponent().getId()==null){
                 return;
          //Extract the index from the component id in the getId method
             int idVal=getId(valueChangeEvent.getComponent().getClientId(FacesContext.getCurrentInstance()));
             ArrayList dataList=getData(); // data from session or request scope
              if((valueChangeEvent.getOldValue()==null && valueChangeEvent.getNewValue()!=null)        
                     || (valueChangeEvent.getOldValue()!=null && valueChangeEvent.getNewValue()==null)){
                 if(dataList!=null && idVal<dataList.size() && idVal>-1){
                     YourBaseValueObject pojo=(YourBaseValueObject)dataList.get(idVal);
                     pojo.setUpdateFlag(true);
             else if(valueChangeEvent.getOldValue()!=null && valueChangeEvent.getNewValue()!=null && !valueChangeEvent.getOldValue().equals(valueChangeEvent.getNewValue())){
                 if(dataList!=null && idVal<dataList.size() && idVal>-1){
                     YourBaseValueObject pojo=(YourBaseValueObject)dataList.get(idVal);
                     pojo.setUpdateFlag(true);
         }HTH.
    Karthik

  • How can i use one datatable inside the other?

    Hi all,
    i need help ... i have this page that shows information from a relational table... for example a mapped table "Countries" that has a java.util.Set inside named "Cities" and i would like 2 know how can i do this using jsf...
    The display would be like this:
    Brasil
    Rio de Janeiro
    Sao Paulo
    USA
    New York
    Washington
    New Orleans
    And Goes on... So i guess it would be a dataTable inside the other, right? but i dunno how to do it...
    Thanks for any info. cya

    this is somehow a messy example. But just focus on the var attribute of outer datatable and how value attribute of inner datatable is referencing it.
    <h:dataTable id="table1" value="#{pc_City_state.listofstates.states}" var="varstates" styleClass="dataTable">
                   <h:column id="column1">
                        <f:facet name="header">
                             <h:outputText styleClass="outputText" value="StateName" id="text2"></h:outputText>
                        </f:facet>
                        <h:outputText id="text3" value="#{varstates.stateName}" styleClass="outputText">
                        </h:outputText>
                   </h:column>
                   <h:column id="column3">
    <f:facet name="header">
    </f:facet>
              <h:dataTable id="table2" value="#{varstates.cities}" var="varcities" styleClass="dataTable">
                                       <f:facet name="footer">
                                       </f:facet>
                                       <h:column id="column4">
              <f:facet name="header">
              <h:outputText styleClass="outputText" value="CityName" id="text6"></h:outputText>
              </f:facet>
              <h:outputText id="text7" value="#{varcities.cityName}" styleClass="outputText">
              </h:outputText></h:column>
              </h:dataTable>
    </h:column>
    </h:dataTable>

  • View images in a datatable from byte[]

    I am trying to view images in a datatable where the image is
    a byte[]. This is what I tried... doesn't work.
    <h:dataTable rows="5" value="#{AirportList.airportList}" var="airport" binding="#{AirportList.airportData}">
              <h:column>
                <f:facet name="header">
                  <h:outputText value="airportCode"/>
                </f:facet>
                <h:outputText value="#{airport.airportCode}"/>
              </h:column>
              <h:column>
                <f:facet name="header">
                  <h:outputText value="airportMap"/>
                </f:facet>
                  <h:inputHidden id="ole" value="#{airport.airportMap}"/>
                  <h:outputText value="#{AirportList.myMap}"/>
                 <div>
                 <!--
                      try
                        byte[] pic = (byte[])request.getAttribute("AirportList.myMap");
                        response.setContentType("image/jpeg");
                        OutputStream os = null;
                        os = response.getOutputStream() ;
                       // os.write(pic);
                        os.close();
                        os = null;
                      catch (Exception ex)
                        out.println("Exception: " + ex.getMessage());
                        ex.printStackTrace();
                   -->
                  </div>
              </h:column>
              <h:column>
                <f:facet name="header">
                  <h:outputText value="airportSugBook"/>
                </f:facet>
                <h:outputText value="#{airport.airportSugBook}"/>
              </h:column>
            </h:dataTable>

    my backing code
    public class Airport
      Collection AirportList;
      private UIData AirportData;
      byte[] MyMap;
      public Airport()
      public Collection getAirportList()
        try{
          InitialContext context = new InitialContext();
          AirportLOBLocalHome home =  (AirportLOBLocalHome)context.lookup("java:comp/env/ejb/local/AirportLOBLocal");
          AirportLOBLocal local = home.create();
          AirportList = local.showAirports();
          Iterator it = AirportList.iterator();
          while(it.hasNext())
            ((OtnAirportLobDetailsLocalDTO)it.next()).getAirportMap();
          return AirportList;
        catch(Throwable e)
          e.printStackTrace();
        return null;
      public void setAirportList(Collection AirportList)
        this.AirportList = AirportList;
      public UIData getAirportData()
        return AirportData;
      public void setAirportData(UIData AirportData)
        this.AirportData = AirportData;
      public byte[] getMyMap()
        OtnAirportLobDetailsLocalDTO ap = (OtnAirportLobDetailsLocalDTO)AirportData.getRowData();
        return ap.getAirportMap();
       // return null;
      public void setMyMap(byte[] MyMap)
        this.MyMap = MyMap;
    }

  • I can't view dataTable in JSF

    Hi, anyone who can help me with java server faces, i want to put data from a resultset to dataTable, i made everithing but my table is not visible.
    My code is:
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">
    <jsp:output omit-xml-declaration="true" doctype-root-element="HTML"
    doctype-system="http://www.w3.org/TR/html4/loose.dtd"
    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
    <jsp:directive.page contentType="text/html;charset=windows-1252"/>
    <f:view>
    <html>
    <head>
    <meta http-equiv="Content-Type"
    content="text/html; charset=windows-1252"/>
    <title>Consultas</title>
    </head>
    <body><h:form binding="#{backing_Consultas.form1}" id="form1">
    <h:commandButton value="commandButton1"
    binding="#{backing_Consultas.commandButton1}"
    id="commandButton1"
    action="#{backing_Consultas.commandButton1_action}"/>
    </p>
    <p>
    <h:dataTable border="1" var="#{backing_Consultas.dataTable1}"
    id="dataTable1">
    <h:column binding="#{backing_Consultas.column1}"/>
    <h:column binding="#{backing_Consultas.column2}"/>
    <h:column binding="#{backing_Consultas.column3}"/>
    <h:column binding="#{backing_Consultas.column4}"/>
    </h:dataTable>
    </h:form></body>
    </html>
    </f:view>
    <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_Consultas-->
    </jsp:root>
    This es a JSPX page.
    Please any idea
    thanks
    alex

    Try to disable the hardware acceleration in the Flash Player.
    See [[Cannot view full screen Flash videos]]
    Flash "Display settings" window:
    * http://www.macromedia.com/support/documentation/en/flashplayer/help/help01.html

  • Can not run complex report with ReportClientDocument using POJO beans.

    Hi All,
    Any help would be very appreciated I have been stack on this issue for the last 4 hours.
    My report has parameters, a ResultSet and subreports that themselves have both parameters and ResultSet.
    The report runs well in Crystal Report Designer but not on my application with ReportClientDocument API.
    The excpeiton I am getting is:
    ======================================================================
    Caused by: java.lang.NullPointerException
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.ParameterFieldController.do(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.bs.a(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.bs.byte(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.a3.if(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.proxy.remoteagent.r.else(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.proxy.remoteagent.r.for(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.proxy.remoteagent.h.for(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.DatabaseController.setDataSource(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.tramada.documents.businessobjects.BODocumentProvider.generateDocument(BODocumentProvider.java:178)
    16:22:56,796 INFO  [STDOUT]      at com.tramada.documents.service.impl.DocumentServiceImpl.generateDocumentContent(DocumentServiceImpl.java:125)
    16:22:56,796 INFO  [STDOUT]      ... 58 more
    This is my class that is trying to do the work.:
    ======================================================================
    BODocumentProvider.java Created on 19/05/2008
    This software is the confidential and proprietary information of Tramada
    Systems Pty Limited.
    package com.tramada.documents.businessobjects;
    import java.io.ByteArrayInputStream;
    import java.util.List;
    import java.util.Locale;
    import com.businessobjects.samples.pojo.POJOResultSetFactory;
    import com.crystaldecisions.sdk.framework.CrystalEnterprise;
    import com.crystaldecisions.sdk.framework.IEnterpriseSession;
    import com.crystaldecisions.sdk.occa.infostore.IInfoObject;
    import com.crystaldecisions.sdk.occa.infostore.IInfoObjects;
    import com.crystaldecisions.sdk.occa.infostore.IInfoStore;
    import com.crystaldecisions.sdk.occa.managedreports.IReportAppFactory;
    import com.crystaldecisions.sdk.occa.report.application.ISubreportClientDocument;
    import com.crystaldecisions.sdk.occa.report.application.ParameterFieldController;
    import com.crystaldecisions.sdk.occa.report.application.ReportClientDocument;
    import com.crystaldecisions.sdk.occa.report.application.SubreportController;
    import com.crystaldecisions.sdk.occa.report.data.Fields;
    import com.crystaldecisions.sdk.occa.report.data.IField;
    import com.crystaldecisions.sdk.occa.report.data.ITable;
    import com.crystaldecisions.sdk.occa.report.data.Tables;
    import com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat;
    import com.crystaldecisions.sdk.occa.report.lib.IStrings;
    import com.tramada.core.utils.SoftMap;
    import com.tramada.documents.DocumentDataProvider;
    import com.tramada.documents.DocumentDescriptor;
    import com.tramada.documents.DocumentFormat;
    import com.tramada.documents.DocumentProvider;
    import com.tramada.documents.SubDocumentDescriptor;
    import com.tramada.documents.businessobjects.model.Template;
    import com.tramada.documents.model.DocumentContent;
    import com.tramada.persistence.home.GenericHome;
    Business Objects specific Document Provider.
    public class BODocumentProvider implements DocumentProvider {
        private static final String BO_AUTH_TYPE = "secEnterprise";
        private boolean connect;
        private String userName;
        private String userPassword;
        private String boURL;
        private String documentsFolder;
        private GenericHome home;
    Local cache. Keeps track of document source for better performance.
        private SoftMap<String, ReportClientDocument> cachedSources = new SoftMap<String, ReportClientDocument>();
        // SETTERS & GETTERS
        // SETTERS & GETTERS
        public GenericHome getHome() {
            return home;
        public void setHome(GenericHome home) {
            this.home = home;
        public boolean getConnect() {
            return connect;
        public void setConnect(boolean connect) {
            this.connect = connect;
        public String getBoURL() {
            return boURL;
        public void setBoURL(String boURL) {
            this.boURL = boURL;
        public String getUserName() {
            return userName;
        public void setUserName(String userName) {
            this.userName = userName;
        public String getUserPassword() {
            return userPassword;
        public void setUserPassword(String userPassword) {
            this.userPassword = userPassword;
        public String getDocumentsFolder() {
            return documentsFolder;
        public void setDocumentsFolder(String documentsFolder) {
            this.documentsFolder = documentsFolder;
        // PUBLIC INTERFACE
    Generates a document given its descriptor.
    @param descriptor
               valid document descriptor
    @return Document (generated document).
        public DocumentContent generateDocument(DocumentDescriptor descriptor, DocumentFormat format) throws Exception {
            if (descriptor == null) {
                throw new IllegalArgumentException("descriptor==null");
            if (format == null) {
                throw new IllegalArgumentException("format==null");
            // get the document source.
            // Can not use setDataSource() error code 2147483648?
            ReportClientDocument document = getDocument(descriptor.getDocumentName());
            ParameterFieldController parameterController = document.getDataDefController().getParameterFieldController();
            // insert the main document parameters and there values
            populateParameters(document.getDataDefController().getDataDefinition().getParameterFields(),
                    parameterController, descriptor, "");
            // insert into the main document all the required data.
            Tables tables = document.getDatabaseController().getDatabase().getTables();
            for (int i = 0; i < tables.size(); i++) {
                ITable table = tables.getTable(i);
                String tableAlias = table.getAlias();
                DocumentDataProvider provider = descriptor.getDocumentDataProvider(tableAlias);
                POJOResultSetFactory factory = new POJOResultSetFactory(provider.getDataType());
                document.getDatabaseController().setDataSource(factory.createResultSet(provider.getData()), tableAlias,
                        tableAlias);
            // go through all the sub-documents and do the same thing as for the
            // main document.
            SubreportController subReportController = document.getSubreportController();
            IStrings names = subReportController.getSubreportNames();
            for (int i = 0; i < names.size(); i++) {
                String subDocumentName = (String) names.get(i);
                SubDocumentDescriptor subDescriptor = descriptor.getSubDocument(subDocumentName);
                // get the actual sub document.
                ISubreportClientDocument subDocument = subReportController.getSubreport(subDocumentName);
                // insert the subdocument parameters.
                populateParameters(subDocument.getDataDefController().getDataDefinition().getParameterFields(),
                        parameterController, subDescriptor, subDocumentName);
                // insert into the main document all the required data.
                Tables subTables = subDocument.getDatabaseController().getDatabase().getTables();
                for (int j = 0; j < subTables.size(); j++) {
                    ITable subTable = subTables.getTable(j);
                    String tableAlias = subTable.getAlias();
                    DocumentDataProvider subProvider = subDescriptor.getDocumentDataProvider(tableAlias);
                    POJOResultSetFactory subFactory = new POJOResultSetFactory(subProvider.getDataType());
                    subDocument.getDatabaseController().setDataSource(subFactory.createResultSet(subProvider.getData()),
                            tableAlias, tableAlias);
            // generate the report in the specified format
            ByteArrayInputStream bais = (ByteArrayInputStream) document.getPrintOutputController().export(
                    getReportFormat(format));
            byte[] content = new byte[bais.available()];
            bais.read(content);
            return (new DocumentContent(content));
    Refreshes the connector and all its cached document sources.
        public void refresh() throws Exception {
            cachedSources.clear();
        // PRIVATE ROUTINES
    Populates the document parameters with there values.
        private void populateParameters(Fields parameters, ParameterFieldController controller,
                DocumentDescriptor descriptor, String documentName) throws Exception {
            for (int i = 0; i < parameters.size(); i++) {
                IField parameter = parameters.getField(i);
                String parameterName = parameter.getName();
                if (!descriptor.getParameters().containsKey(parameterName)) {
                    throw new IllegalStateException("missing parameter entry for '" + parameterName + "'");
                Object value = descriptor.getParameter(parameterName);
                if (value != null) {
                    controller.setCurrentValue(documentName, parameterName, value);
    Retrieves the document source. If the source is not cached get it from
    BO. First get the template name that is stored on BO.
        private ReportClientDocument getDocument(String documentName) throws Exception {
            ReportClientDocument source = cachedSources.get(documentName);
            if (source == null) {
                String templateName = getTemplateName(documentName);
                if (userName == null) {
                    throw new IllegalArgumentException("user-name==null");
                if (userPassword == null) {
                    throw new IllegalArgumentException("user-password==null");
                if (boURL == null) {
                    throw new IllegalArgumentException("boURL==null");
                if (documentsFolder == null) {
                    throw new IllegalArgumentException("documents-folder==null");
                // login to BO
                IEnterpriseSession enterpriseSession = CrystalEnterprise.getSessionMgr().logon(userName, userPassword,
                        boURL, BO_AUTH_TYPE);
                IInfoStore iStore = (IInfoStore) enterpriseSession.getService("InfoStore");
                // get the application folder.
                IInfoObjects folders = iStore.query("Select SI_ID From CI_INFOOBJECTS Where SI_PROGID='CrystalEnterprise.Folder' And SI_NAME = '"
                        + documentsFolder + "'");
                if (folders.size() != 1) {
                    throw new IllegalStateException("documents folder '" + documentsFolder + "' not found on BO Server '"
                            + boURL + "'.");
                IInfoObject folder = (IInfoObject) folders.get(0);
                // get the document identified by the template name.
                IInfoObjects templates = iStore.query("select SI_ID, SI_NAME From CI_INFOOBJECTS "
                        + "where SI_PROGID = 'CrystalEnterprise.Report' " + "And SI_INSTANCE_OBJECT = 0 "
                        + "And SI_PARENT_FOLDER = " + folder.getID() + " And SI_NAME= '" + templateName + "'");
                if (templates.size() != 1) {
                    throw new IllegalStateException("template with name '" + templateName + "' not found in folder '"
                            + documentsFolder + "'on BO Server '" + boURL + "'.");
                source = ((IReportAppFactory) enterpriseSession.getService("RASReportFactory")).openDocument(
                        ((IInfoObject) templates.get(0)).getID(), 0, Locale.getDefault());
                cachedSources.put(documentName, source);
            return (source);
    Returns the associated template name for the given document descriptor.
        @SuppressWarnings("unchecked")
        private String getTemplateName(String documentName) {
            Template example = new Template();
            example.setDocumentName(documentName);
            List<Template> templates = (List<Template>) home.findByExampleExcludingAssociations(example);
            if (templates == null || templates.size() != 1) {
                throw new IllegalStateException("no template defined for document name '" + documentName + "'");
            return (templates.get(0).getTemplateName());
    Get the equivalent BO format for the given document format.
    @param format
               document format.
    @return ReportExportFormat
        private ReportExportFormat getReportFormat(DocumentFormat format) {
            if (format.equals(DocumentFormat.PDF)) {
                return (ReportExportFormat.PDF);
            } else if (format.equals(DocumentFormat.WORD)) {
                return (ReportExportFormat.MSWord);
            } else if (format.equals(DocumentFormat.EXCEL)) {
                return (ReportExportFormat.MSExcel);
            return (ReportExportFormat.MSWord);
    Best Regards
    Khalef  Bessaih

    Hello,
    If I understand correctly, you create a local report which choose report from Report Server. You have two query parameters in the report which are returned by stored procedure. Currently, you cannot get default values for these parameters when run the report.
    Based on my test, if we haven’t configure these parameter with Available Values, we can reproduce the same issue. Also, caching issue may cause the same issue. If the issue is persist, please delete the corresponding report in the report server. Then, redeploy
    it to check.
    There is a similar issue, you can refer to it.
    http://social.msdn.microsoft.com/Forums/en-US/6a548d65-35d0-4a3e-8b64-3b7b655c76ee/ssrs-2008-report-parameter-default-value-doesnt-work-when-deployed
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • DataTable.Rows.Count property is occasionally wrong

    I have a web service in C#.NET which calls a stored procedure using ADO.NET. The stored procedure is always returning 1 row, which is then loaded into a DataTable. The Rows.Count property of the DataTable is then examined.
    When this web service is called repeatedly with numerous requests, it occasionally returns Rows.Count as 0 when it should be 1. I have debugged and examined it at runtime and found that there is indeed 1 row in the datatable, but that the Rows.Count property
    is 0.
    Is this a known bug?
    I'm using .Net Framework 2.0
    Note: This is an issue that occurs very rarely. My testing shows that it takes about 90 minutes to recreate it when you have 2 concurrent processes sending requests repeatedly at a rate of about 10 requests per second.

    Are you sure that there aren't multiple threads access the DataTable?
    Can you post a repro? 
    David
    David http://blogs.msdn.com/b/dbrowne/

  • Is there a way to add a column after a filled DataTable from SQL with the same rows?

    My problem is that not to add rows like filled by SQLDataAdapter at the same row in DataGridView. How to make that? I showed below the details with my code also a screen shot, which shows the rows differences from the origin one.
    I don't want to add an expression as column behave in my sql script to get what I need with query result. I don't want to obtain that way.
    using (SqlConnection c = new SqlConnection(ConnStrMSSQL))
    c.Open();
    // 2
    // Create new DataAdapter
    using (SqlDataAdapter a = new SqlDataAdapter("SELECT SIPNO, SERINO, TARIH FROM SNOHAREKETLER WHERE Cast(TARIH as DATE) BETWEEN '2015/03/20' AND '2015/03/20' AND (TEZNO = 'T23' OR TEZNO = 'T31') AND CIKTI is null", c))
    // 3
    // Use DataAdapter to fill DataTable
    DataTable t = new DataTable();
    a.Fill(t);
    t.Columns.Add("MyColumn", typeof(string));
    DataRow workRow;
    int iGetCount = t.Rows.Count;
    for (int i = 0; i <= iGetCount - 1; i++)
    workRow = t.NewRow();
    workRow["MyColumn"] = i;
    t.Rows.Add(workRow);
    dataGridView1.DataSource = t;

    The extra column isn't applied to only certain rows.  The columns of a table identify what data each row will contain.  Hence adding a column to the table automatically adds them to the rows.  What you're seeing is that all the initial rows
    aren't being assigned a value so they retain their default value of null.  Later you enumerate the rows of the existing table and call AddRow which adds new rows.  This isn't adding columns, but rows.
    To generate values for the existing rows you should ideally simply pass the data back from the database.  DT computed columns can be difficult to set up as it is limited to what it can do.  If you want to use a computed column on the Datatable
    itself then define the column as a computed column and every row will calculate its own value.
    DataTable data = GetData();
    //Add elapsed time column
    var col = new DataColumn("ElapsedTime", typeof(TimeSpan), "expr");
    data.Columns.Add(col);
    dataGridView1.DataSource = data;
    The issue you will run into however is that calculating a diff on DateTime doesn't work in a computed column as the expression doesn't support the necessary functions.  You can google for how people solved this if you are interested in alternatives. 
    Most people just tend to add the column and then hook into the various change events to update the value as needed.

Maybe you are looking for