I am using myfaces.
 
The bean class [searchbean] looks like this :
 
 public JdbcRowSet getdataresult()
    {
        if (dataresult != null)
        return dataresult;
        else
            return null;
    }
 
public String doQuery()
    {
     .................
.    .................
     try {
            dataresult  =Connect(sqlquery);
        } catch (SQLException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            ctx.addMessage(null, new FacesMessage(e.toString()));
            return "error";
        } catch (ClassNotFoundException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            ctx.addMessage(null, new FacesMessage(e.toString()));
            return "error";
        }
                    //--------finished
      return "success";
    }    
 

public JdbcRowSet Connect (String query) throws SQLException, ClassNotFoundException {

      Class.forName("org.postgresql.Driver");
      JdbcRowSetImpl jrs = new JdbcRowSetImpl();
      jrs.setCommand(sqlquery);
      jrs.setUrl("jdbc: postgresql://bungo:5432/vods");
      jrs.setUsername("vodsview");
      jrs.setPassword("");
        System.out.println("inside this method connect");
      jrs.execute();
      return jrs;
    }

 
the showresult.jsp looks like this
 

<?xml version="1.0"?>
<jsp:root version="2.0" xmlns:jsp="
http://java.sun.com/JSP/Page"
 xmlns:h="
http://java.sun.com/jsf/html "
 xmlns:f="
http://java.sun.com/jsf/core "
    xmlns:x="
http://myfaces.apache.org/extensions">

 <jsp:directive.page contentType="text/html;charset=UTF-8"
  isELIgnored="false" />
 <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" />

 <html>
  <head>
   <title>VODS log search result</title>
  </head>
  <body>
   This is the result page.
      <f:view>
        <h:dataTable  id = "data"
                rendered = "true"
                styleClass= "table-background"
                rowClasses= "table-odd-row,table-even-row"
                cellpadding="3"
                value="#{searchBean.dataresult}"
                var="row">

           <h:column>
            <f:facet name= "Header">
            <h:outputText value ="Sender"/>
            </f:facet>
            <h:outputText value ="#{row.Sender}" />
           </h:column>


       </h:dataTable>
      </f:view>
      </body>
  </html>
</jsp:root>

I get an error that the resultsetDatamodel is not implemented......i hope this help....
 
Shibi
 
On 7/18/05, Johannes Hiemer <[EMAIL PROTECTED]> wrote:

Hi Shibi,
here is an example on how it works for me:
<h:dataTable id="bean" rowClasses="row"
                               value="#{searchSystemdataSpringBean.bean}"
                               var="systemdata" styleClass="hidden">
                               <h:column>
                                       <f:facet name="header">
                                               <h:outputText value="#{bundle.searchSystemTagNumber}" />
                                       </f:facet>
                                       <h:commandButton styleClass="button" id="tagnumber" value="#{systemdata.sdtagnumber}"   passToParentWindow(id, value)" />
                               </h:column>
                               <h:column>
                                       <f:facet name="header">
                                               <h:outputText  value="#{ bundle.searchSystemModel}" />
                                       </f:facet>
                                       <h:outputText id="model" value="#{systemdata.sdmodel}" />
                               </h:column>
                               <h:column>
                                       <f:facet name="header">
                                               <h:outputText  value="#{ bundle.searchSystemSn}" />
                                       </f:facet>
                                       <h:outputText id="systemnumber" value="#{systemdata.sdsn}" />
                               </h:column>
                               <h:column>
                                       <f:facet name="header">
                                               <h:outputText value="#{ bundle.searchSystemType}" />
                                       </f:facet>
                                       <h:outputText id="systemtype" value="#{systemdata.sdtype}" />
                               </h:column>
                       </h:dataTable>
The important things are value="#{searchSystemdataSpringBean.bean}" assigning the values from the backed bean, the next stept is putting these values into var="systemdata", and after that you can output them normaly like this:
<h:outputText id="systemtype" value="#{systemdata.sdtype}" />

       private List bean;

       public void search(ActionEvent event) {
               HtmlDataTable dataTable = (HtmlDataTable) event.getComponent()
                               .findComponent("bean");
               if (getSystemdata().getSdtagnumber() == null) {
                       bean = getSystemdataManager().getSystemdatas();
               }
       }
As you can see, bean is just a normal list.
That's the way it works for me, if you could provide a bit more code, it would be easyer to figure out your problem.

Hope that helps.

Regards Johannes
wishfully waiting for the cooling tempest.

"MyFaces Discussion" <[email protected]> schrieb am 18.07.05 13:57:47:
> Hi,   i am trying to use <x:dataTable to diplay a resultset [from postgresql]. I have wrapped the resultset into a JDBCrowset. I am using jetty . Basically the data doesn't get displayed on the we browser.   i get the  following error:
>   13:40:15.610 WARN!! [P1-19] org.apache.myfaces.renderkit.html.HtmlRenderKitImpl.
> getRenderer(HtmlRenderKitImpl.java:67) >36> Unsupported component-family/rendere
> r-type: javax.faces.ViewRoot /org.apache.myfaces.Table    Could anybody give an example of how they have done this or kindy help me here
> --
> Kind Regards
> Shibi Thomas
>
>
>
>


______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193




--
Kind Regards
Shibi Thomas

Can a mother forget the baby at her breast and have no compassion on the child she has borne?
Though she may forget, I will not forget you! See, I have engraved you on the palms of my hands; your walls are ever before me. [Isaiah 49:15,16]


Reply via email to