Display mysql table data in a jsf page? (10 duke dollars up for grabs)

hi,
im having some trouble on how to display data from a mysql table in a JSF page under the JSF architecture. i need some help on the best and correct way of doing this?
if you could provide code on how this is done, would be much appreciated.
many thanks.

I'm going to assume that you have had experience with doing this in jsp. Watch for my comments by the **** asterisks *****. My skill level is best described as intermediate, so you'll probably want to heed replies from the more accomplished members of the community to improve upon this advice.
The jsp page:
<%@ page language="java" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://myfaces.apache.org/extensions" prefix="x" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
***** All of your jsf content must be between the f:view tags ******
<f:view>
<html lang="en-US" xml:lang="en-US">
<head>
<title>Page Title</title>
</head>
<body>
***** Here is the h:form tag which constructs the appropriate html form tag.
***** You don't need to worry about get/post and all that.
<h:form>
***** The h:panelGrid constructs a table that I'm using purely for layout purposes *****
<h:panelGrid width="800" columnClasses="textColumns">
***** the h:dataTable is doing the heavy lifting here. the var attribute is the name you
               want to give to the data you're returning. The value
               attribute it bound to a managed bean named MemberList in my faces-config and all refers
               to a method named getAll (in bean style) that returns a java.sql.Result.
          ***** You can see below how the columns are laid out with the h:column tags and how the header for
                         the columns are named.
          ***** The dataTable iterates over each value in the outputText tags contained in the column tags.
                         It's bound by the var_name.query_field_name. The field name is the one bundled in your result
          ***** Scroll down to see the MemberList bean code.
<h:dataTable var="foo" value="#{MemberList.all}">
<h:column>
<f:facet name="header">
<h:outputText value="Name"/>
</f:facet>
<h:outputText value="#{foo.name}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="bar Number"/>
</f:facet>
<h:outputText value="#{foo.ANET_NUM}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Group"/>
</f:facet>
<h:outputText value="#{foo.CUST_GROUP}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Classification"/>
</f:facet>
<h:outputText value="#{foo.CLASSIFICATION}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Sector"/>
</f:facet>
<h:outputText value="#{foo.SECTOR}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Address"/>
</f:facet>
<h:outputText value="#{foo.ADDRESS1}"/><f:verbatim><br></f:verbatim>
<h:outputText escape="false" value="#{MemberList.ADDRESS2} <br>"
rendered="#{MemberList.ADDRESS2 != null}"/>
<h:outputText value="#{foo.CITY}"/><f:verbatim>, </f:verbatim>
<h:outputText value="#{foo.STATE}"/><f:verbatim>, </f:verbatim>
<h:outputText value="#{foo.ZIP}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Purchasing Contact"/>
</f:facet>
<h:outputText value="#{foo.CONTACT}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Purchasing Phone"/>
</f:facet>
<h:outputText value="#{foo.WORK}"/>
</h:column>
</h:dataTable>
</h:panelGrid>
</h:form>
</body>
</html>
</f:view>
*** MemberList bean code:
package bar.vendor;
import bar.dbConnectionInfo;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.naming.NamingException;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.jstl.sql.Result;
import javax.servlet.jsp.jstl.sql.ResultSupport;
import java.sql.*;
public class MemberList extends dbConnectionInfo {
private Connection conn;
public void open() throws SQLException, NamingException {
******* Here is where I set up my connection info. I store it in a separate class.
******* You'll set yours up according to your MySQL settings.
conn = DriverManager.getConnection(getUrl(), getUsername(), getPassword());
          ******* The rest of this is pretty standard. The only exceptions is where I use the FacesContext
          ******* to get the session and getting a parameter map (see below)
public Result getAll() throws SQLException, NamingException {
FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext extContext = facesContext.getExternalContext();
HttpSession session = (HttpSession) extContext.getSession(true);
ResultSet rs = null;
String schema = getOracleOwner();
String sql = "select distinct c.name, c. ANet_Num, ug.cust_group, ug.classification, c.sector, " +
" a.address1, a.address2, a.city, a.state, a.zip," +
" trim(cc.fname) || ' ' || trim(cc.lname) as Purchasing_Contact, cc.work " +
" from "+schema+".cust c, "+schema+".vw_unique_cust_address u, "+schema+".cust_address a, " +
" "+schema+".cust_group cg, "+schema+".vw_purchasing_contact pc, "+schema+".cust_contact cc, " +
" "+schema+".baruser nu, "+schema+".dist_contact dc, "+schema+".contract con, " +
" "+schema+".contract_access ca, "+schema+".vw_unique_cust_groups ug " +
" where nu.id = ? " +
" and c.SECTOR = ? " +
" and nu.fk_dist_contact_id = dc.id " +
" and dc.fk_dist_id = con.fk_dist_id " +
" and con.id = ca.fk_contract_id " +
" and ca.fk_group_type_id = cg.fk_group_type_id " +
" and cg.fk_cust_id = c.id " +
" and c.id = u.id " +
" and to_number(substr(u.desc_type,2)) = a.id(+) " +
" and c.id = pc.id(+) " +
" and pc.cc_id = cc.id(+) " +
" and c.status = 'Active' " +
" and c.id = ug.id " +
" order by ug.cust_group, c.name";
try {
open();
PreparedStatement ps = conn.prepareStatement(sql);
ps.setString(1, (String) session.getAttribute("baruserID"));
**** This is cool. Look at the f:param tag as it pertains to commandButtons and commandLinks *****
ps.setString(2,(String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("sector"));
rs = ps.executeQuery();
} catch (SQLException sqle) {
System.out.println(sqle.getMessage());
} catch (Exception e){
System.out.println(e.getMessage());
//close();
return ResultSupport.toResult(rs);
public void close() throws SQLException {
if (conn == null) return;
conn.close();
conn = null;
}

Similar Messages

  • How to display a table data on Screen having a Table control

    Hi ,
    I am new to ABAP.I would like to display a table data (Eg: ZDemo) on a screen at run time.I have defined a Table control in screen. Now I want to populate data from ZDemo to table control.How can I do that?Please help moving forward in this regard.

    Hi Gayatri,
      After creating table control do the following steps.
    1. In the flow logic section write the following code:
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0200.
    LOOP AT I_LIKP WITH CONTROL LIKP_DATA CURSOR LIKP_DATA-CURRENT_LINE.
      MODULE ASSIGN_DATA.
    ENDLOOP.
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0200.
    LOOP AT I_LIKP.
    ENDLOOP.
    I_LIKP is the internal table which is used to display table data in the table control.
    2. In Process Before Output, in the module STATUS_0200 write the following code:
      DESCRIBE TABLE I_LIKP LINES FILL.
      LIKP_DATA-LINES = FILL.
      In Process After Input, in the module USER_COMMAND_0200 write the following code:
      CASE SY-UCOMM.
       WHEN 'LIPS'.
        READ TABLE I_LIKP WITH KEY MARK = 'X'.
        SELECT VBELN
               POSNR
               WERKS
               LGORT
               FROM LIPS
               INTO TABLE I_LIPS
               WHERE VBELN = I_LIKP-VBELN.
        IF SY-SUBRC = 0.
         CALL SCREEN 200.
        ENDIF.
       WHEN 'BACK'.
        SET SCREEN 200.
      ENDCASE.
    In Process Before Output and in the module ASSIGN_DATA which is there inside the loop write the following code:
    MOVE-CORRESPONDING I_LIKP TO LIKP.
    So, Totally your flow logic code should be like this.
    TABLES: LIKP, LIPS.
    DATA: BEGIN OF I_LIKP OCCURS 0,
           VBELN LIKE LIKP-VBELN,
           ERNAM LIKE LIKP-ERNAM,
           ERZET LIKE LIKP-ERZET,
           ERDAT LIKE LIKP-ERDAT,
           MARK  TYPE C VALUE 'X',
          END OF I_LIKP,
          BEGIN OF I_LIPS OCCURS 0,
           VBELN LIKE LIPS-VBELN,
           POSNR LIKE LIPS-POSNR,
           WERKS LIKE LIPS-WERKS,
           LGORT LIKE LIPS-LGORT,
          END OF I_LIPS,
          FILL TYPE I.
    CONTROLS: LIKP_DATA TYPE TABLEVIEW USING SCREEN 200,
              LIPS_DATA TYPE TABLEVIEW USING SCREEN 300.
    DATA: COLS LIKE LINE OF LIKP_DATA-COLS.
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
    CASE SY-UCOMM.
      WHEN 'LIKP'.
       SELECT VBELN
              ERNAM
              ERZET
              ERDAT
              FROM LIKP
              INTO TABLE I_LIKP
              WHERE VBELN = LIKP-VBELN.
       IF I_LIKP[] IS INITIAL.
         CALL SCREEN 200.
       ENDIF.
      WHEN 'EXIT'.
       LEAVE PROGRAM.
    ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  assign_data  OUTPUT
          text
    MODULE ASSIGN_DATA OUTPUT.
    MOVE-CORRESPONDING I_LIKP TO LIKP.
    ENDMODULE.                 " assign_data  OUTPUT
    *&      Module  STATUS_0200  OUTPUT
          text
    MODULE STATUS_0200 OUTPUT.
      DESCRIBE TABLE I_LIKP LINES FILL.
      LIKP_DATA-LINES = FILL.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    *&      Module  USER_COMMAND_0200  INPUT
          text
    MODULE USER_COMMAND_0200 INPUT.
      CASE SY-UCOMM.
       WHEN 'LIPS'.
        READ TABLE I_LIKP WITH KEY MARK = 'X'.
        SELECT VBELN
               POSNR
               WERKS
               LGORT
               FROM LIPS
               INTO TABLE I_LIPS
               WHERE VBELN = I_LIKP-VBELN.
        IF SY-SUBRC = 0.
         CALL SCREEN 200.
        ENDIF.
       WHEN 'BACK'.
        SET SCREEN 200.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0200  INPUT
    Save and Activate the program along with the screen in which you have included table control.
    Hope this will help you.
    Regards
    Haritha.

  • Display Nested table data in an ALV format

    Hi All,
    Is there any way to display nested table data in an ALV format. This table has 20-30 structures in it and there is no way to create a common structure using all the fields. Kindly let me know what is the best way to display the nested structure data.
    Thanks a lot for your responce.
    Regards,
    Priti

    REPORT  yh_alvtreedemo1.
    TYPE-POOLS : fibs,stree.
    TYPE-POOLS:slis.
    DATA : t_node TYPE snodetext.
    DATA : it_node LIKE TABLE OF t_node,
           wa_node LIKE t_node.
    DATA: t_fieldcat    TYPE slis_t_fieldcat_alv,
          fs_fieldcat   TYPE slis_fieldcat_alv.
    DATA:w_repid LIKE sy-repid.
    *Internal Table declarations
    DATA: BEGIN OF fs_scarr,
            carrid LIKE scarr-carrid,
          END OF fs_scarr.
    DATA:BEGIN OF fs_spfli,
            carrid LIKE spfli-carrid,
            connid LIKE spfli-connid,
         END OF fs_spfli.
    DATA:BEGIN OF fs_sflight,
            carrid LIKE sflight-carrid,
            connid LIKE sflight-connid,
            fldate LIKE sflight-fldate,
         END OF fs_sflight.
    DATA:BEGIN OF fs_sbook,
            carrid LIKE sbook-carrid,
            connid LIKE sbook-connid,
            fldate LIKE sbook-fldate,
            bookid LIKE sbook-bookid,
         END OF fs_sbook.
    DATA:t_scarr LIKE TABLE OF fs_scarr,
         t_spfli LIKE TABLE OF fs_spfli,
         t_sflight LIKE TABLE OF fs_sflight,
         t_sbook LIKE TABLE OF fs_sbook.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM build_tree.
      PERFORM display_tree.
    *&      Form  get_data
    FORM get_data .
      SELECT carrid
             FROM scarr
             INTO TABLE t_scarr.
      SELECT carrid
              connid
              FROM spfli
              INTO TABLE t_spfli
              FOR ALL ENTRIES IN t_scarr
              WHERE carrid EQ t_scarr-carrid.
    ENDFORM.                    " get_data
    *&      Form  build_tree
    FORM build_tree .
      CLEAR: it_node,
             wa_node.
      SORT: t_scarr BY carrid,
            t_spfli BY carrid connid,
            t_sflight BY carrid connid fldate,
            t_sbook BY carrid connid fldate bookid.
      wa_node-type = 'T'.
      wa_node-name = 'Flight Details'.
      wa_node-tlevel = '01'.
      wa_node-nlength = '15'.
      wa_node-color = '4'.
      wa_node-text = 'Flight'.
      wa_node-tlength ='20'.
      wa_node-tcolor = 3.
      APPEND wa_node TO it_node.
      CLEAR wa_node.
      LOOP AT t_scarr INTO fs_scarr.
        wa_node-type = 'P'.
        wa_node-name = 'CARRID'.
        wa_node-tlevel = '02'.
        wa_node-nlength = '8'.
        wa_node-color = '1'.
        wa_node-text = fs_scarr-carrid.
        wa_node-tlength ='20'.
        wa_node-tcolor = 4.
        APPEND wa_node TO it_node.
        CLEAR wa_node.
        LOOP AT t_spfli INTO fs_spfli WHERE carrid EQ fs_scarr-carrid.
          wa_node-type = 'P'.
          wa_node-name = 'CONNID'.
          wa_node-tlevel = '03'.
          wa_node-nlength = '8'.
          wa_node-color = '1'.
          wa_node-text = fs_spfli-connid.
          wa_node-tlength ='20'.
          wa_node-tcolor = 4.
          APPEND wa_node TO it_node.
          CLEAR wa_node.
        ENDLOOP.
      ENDLOOP.
    ENDFORM.                    " build_tree
    *&      Form  display_tree
    FORM display_tree .
      CALL FUNCTION 'RS_TREE_CONSTRUCT'
        TABLES
          nodetab = it_node.
      w_repid = sy-repid.
      CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
        EXPORTING
          callback_program      = w_repid
          callback_user_command = 'USER_COMMAND'
          callback_gui_status   = 'SET_PF'.
    ENDFORM.                    " display_tree
    *&      Form  pick
    *      -->COMMAND    text
    *      -->NODE       text
    FORM user_command    TABLES pt_nodes         STRUCTURE seucomm
                                 USING pv_command       TYPE c
                             CHANGING pv_exit        TYPE c
                                      pv_list_refresh  TYPE c.
      pv_list_refresh = 'X'.
      IF pt_nodes-tlevel = '03'.
        CLEAR t_fieldcat[].
        SELECT carrid
               connid
               fldate
               FROM sflight
               INTO TABLE t_sflight
               WHERE connid EQ pt_nodes-text.
        fs_fieldcat-col_pos = 1.
        fs_fieldcat-fieldname = 'CARRID'.
        fs_fieldcat-seltext_m = 'Airlinecarrier'.
        fs_fieldcat-key = 'X'.
        fs_fieldcat-hotspot = 'X'.
        APPEND fs_fieldcat TO t_fieldcat.
        CLEAR fs_fieldcat.
        fs_fieldcat-col_pos = 2.
        fs_fieldcat-fieldname = 'CONNID'.
        fs_fieldcat-seltext_m = 'Connection No'.
        fs_fieldcat-key = 'X'.
        fs_fieldcat-hotspot = 'X'.
        APPEND fs_fieldcat TO t_fieldcat.
        CLEAR fs_fieldcat.
        fs_fieldcat-col_pos = 3.
        fs_fieldcat-fieldname = 'FLDATE'.
        fs_fieldcat-seltext_m = 'Flight Date'.
        fs_fieldcat-key = 'X'.
        fs_fieldcat-hotspot = 'X'.
        APPEND fs_fieldcat TO t_fieldcat.
        CLEAR fs_fieldcat.
        w_repid = sy-repid.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            i_callback_program = w_repid
            it_fieldcat        = t_fieldcat[]
          TABLES
            t_outtab           = t_sflight.
      ENDIF.
    ENDFORM.                    "pick
    *&      Form  set_pf
    *       text
    FORM set_pf.
      SET PF-STATUS 'MYPF'.
    ENDFORM.                    "set_pf

  • Netbeans 6.0 web page Error adding data to mySQL table - date datatype

    Netbeans 6.0 web page, trying to add data into a mySQL table. The table has a datetime datatype. The add does not work when trying to add a record. I have no problems when I add a record to a table without a date datatype. Here is my code.
    RowKey rk = fwusersDataProvider.appendRow();
    fwusersDataProvider.setCursorRow(rk);
    fwusersDataProvider.setValue("fwusers.userid", userid);
    fwusersDataProvider.setValue("fwusers.password", pwd);
    fwusersDataProvider.setValue("fwusers.firstName", "A");
    fwusersDataProvider.setValue("fwusers.lastName", "K");
    fwusersDataProvider.setValue("fwusers.middleName", "");
    fwusersDataProvider.setValue("fwusers.companyName", "DCC");
    fwusersDataProvider.setValue("fwusers.password1", "");
    fwusersDataProvider.setValue("fwusers.password2", "");
    fwusersDataProvider.setValue("fwusers.password3", "");
    Calendar cal= Calendar.getInstance();
    java.sql.Date sqlDate = new java.sql.Date(cal.getTime().getTime() );
    fwusersDataProvider.setValue("fwusers.dateCreated", sqlDate );
    fwusersDataProvider.setValue("fwusers.group", "worker");
    fwusersDataProvider.commitChanges();
    fwusersDataProvider.refresh();

    bkrivensky wrote:
    Netbeans 6.0 web page, trying to add data into a mySQL table. The table has a datetime datatype. The add does not work when trying to add a record. Don't suppose you want to share the error message you're getting do ya? Go on, be a sport.

  • New page in smart form when displaying internal table data in table

    Hi ,
    My requirement in smartform is like
    I'm using the tables to display the internal table data in main window .
    based on SORTF field in the internal table ,when SORTF field value changes all the related to that SORTF value should be displayind in the new page.
    Please anybody tell me that , how to do this?
    Thanks
    Naveen

    Hi Navi,
        Try this Logic.
    1) Go to Smartform,
    2) Declare a flag variable w_flag type c
    3)Go to Main Window
       a) Go to table
       b) Create one more Table Line
       c) Create a CODE Line in that.
           write inside CODE  as Below:-
                 CLEAR: w_flag.
                 ON CHANGE OF w_final-sortf.
                   w_flag  = 'X'.
                  ENDON.
       d) Create one COMMAND Under CODE line created above.
           click on check Box "Go to New Page"  ( Page1 or Page2 or give as reqd ).
           click on conditions tabe of COMMAND
           write: w_flag = 'X'.
    Hope this will work
    Reward Points if Useful
    regards
    Avi.............

  • Getting problem in binding DropDown List with table data in visual JSF

    Hi All,
    I am new to visual JSF.
    I am getting few problems while working over components.
    I have succeeded in binding data of Person table in a drop down list .
    By just drag drop ..it worked.
    But while connecting to external DB this drag drop mechanism didn't work for me .
    1st problem that i faced was by dragging method columns are not visible when i did right click-> bind to Data -> DataProvider window .
    But i am successfully printed table Data in backend ie: by putting
    for(int i=0; i<xn_white_listDataProvider.getAllRows().length;i++){
           System.out.println("  value :"+xn_white_listDataProvider.getValue("SUB_ID",xn_white_listDataProvider.getRowKey(Integer.toString(i))));
    }I am not getting how to set Items in dropdown1
    I tried putting
    HelloSh.xn_white_listDataProvider.options['XNODE.XN_WHITE_LIST.SUB_ID, XNODE.XN_WHITE_LIST.SUB_ID'but it didn't work while for person data table
      items="#{HelloSh.personDataProvider.options['PERSON.PERSONID,PERSON.NAME']}"it is working
    when i am writting items="24,28" in dropdown1 box
    & printing its value in static text Like
    <webuijsf:staticText id="staticText3" style="position: absolute; left: 72px; top: 120px" text="#{HelloSh.dropDown1.items}"/> it is printing fine .
    Plz help me in this regard.
    Any clarification if needed plz let me know.
    Thanks in advance.

    <h:selectOneMenu id="menu1" styleClass="selectOneMenu">
    <f:selectItems value="*#{selectitems.pc_DynamicPortletEdit.regList}*" />
    </h:selectOneMenu>When we bind the list to the h:selectOneMenu the code in the JSP will be as given above.
    My doubts here are
    1) But when i tried to bind the list to a selectonemenu the code in the JSP is looking like this one
    <h:selectOneMenu id="menu1" styleClass="selectOneMenu">
    <f:selectItems value="*#{selectitems.pc_DynamicPortletEdit.regList.regList.toArray}*" />
    </h:selectOneMenu>2) Also in the runtime instead of displaying the values in the dropdown, i am getting the object names (javax.faces.model.SelectItem@680d0ccc) in the drop down.
    What am I doing wrong? Any help here would be usefull for me.
    BTW,
    the code in the backing bean for setting the values is like this
    List dropListValue = new ArrayList();
        for (int x=0; x<result.length; x++){ //where result is array of string values              
            SelectItem tempSelect = new SelectItem();
            tempSelect.setLabel(result[x]);
            tempSelect.setValue(result[x]);
            dropListValue.add(result[x]);                      
    this.setRegList(dropListValue );The bean is in request scope only.

  • JDev 1013, Webservice as Data Control in JSF page returns error

    Hello,
    For a client we are starting a project with Java Server Faces in combination with web services. In order to do some testing we created a web service in PLSQL (with a empno input field and a record output) and deployed this web service on an OC4J container. We then created a (new) JSF project, used the PLSQL web service as a Data Source, and used this Data Source in a JSF page.
    When this JSF page is started an error occurs validation -
    DCA-40007: The value for parameter "empNo" cannot be null..
    The webservice can however be called in the page, the output is shown but the error stays in the page.
    Communication with support gave me a temporary solution
    I've put in the page definition for both the methodIterator (getEmpIter) and the accessIterator (ReturnIterator) the Refresh="Deferred". Now the error doesn't show in the page at startup of the page. Data is presented correctly after pushing the button, though still in the Jdeveloper Embedded OC4J Server Log shows a list of
    ERROR Value for parameter : 'empNo' cannot be null.
    In a multi row Webservice (created by JDeveloper) however i still get this error.
    (1) What caused this error?
    (2) When is the next version of JDeveloper due?
    (3) I am looking for documentation on the following subjects
    (3.1) How a JSF page is rendered by the Oracle JSF implementation
    (3.2) How to read and adjust the JSF page definition, for example the <executables> part
    (3.3) Problem with the extra abstraction layer is that is very hard to find where an error occurs. Is a mechanism/documentation available to find in which JSF fase an error occurs and how to bypass it?
    Regards Leon Smiers

    (1) I think what is happening is that your page calls out to the Web service when you first run it without any parameter. This is why you get the error and also the reason that deffer works to solve this.
    I think a solution would be to have your Web service handle the case of receiving an empty parameter.
    (2) When it is ready :-)
    (3.2) right click the jsf page and choose "go to page defenition" you can then edit it using the structure pane and the property inspector.
    (3.3) you can run in debug mode, the code for ADF will be available when we go production, and with it a lot of more documentation.

  • Can I display the table content of a web page??

    Hi guys I am new to java and here I need to count the words in each table and display the table with largest number of words . This being a part of my huge project. Below is my code where I have succeeded in displaying all the tables present in the web page.But I need to count all the words in the table and display only that table which has largest number of words including all the tags. So java experts please help me with this piece of code...................
    import java.net.*;
    import java.io.*;
    import java.util.*;
    import java.util.regex.*;
    public class findtable{
      public static void main(String[] args) {
        String inputLine = null;
        String wholeHtml = "";
    int trcount=0;
        try{
          URL yahoo = new URL("http://books.google.com/books?q=+subject:%22+Science+Fiction+%22&as_brr=3&rview=1&source=gbs_hplp_fict");
          URLConnection yahooConnection = yahoo.openConnection();
          BufferedReader br = new BufferedReader
            (new InputStreamReader(yahooConnection.getInputStream()));
          int start = 0;
          while ((inputLine = br.readLine()) != null) {
            wholeHtml += inputLine;
            if (inputLine.contains("<table")){
                      ++start;
            if (start != 0) {
              System.out.println(inputLine);
            if (inputLine.contains("</table>")) {
              --start;
        catch (MalformedURLException me) {
           System.out.println("MalformedURLException: " + me);
        catch (IOException ioe) {
          System.out.println("IOException: " + ioe);
        }So any help would be really really appreciated....
    The code should take care of nested tables also..
    So guys looking forward for the generous help....

    I have already parsed the HTML and checked all the closing of tags and corrected the indent using Tidy and then I have applied this code so some other suggestions please

  • Adf faces table and applet in jsf page navSubmit not working in IE

    Hi
    I have a jsf page with adf faces table and applet , previous / next navigation is not working for my table when i add the applet to the same page , it is working in firefox but not in IE .
    I have no clue what to change , can any one help. below is the sample code for my jsf page
    Best regards
    Srinivas
    Code follows, not sure how to format the code here
    <h:form>
    <af:panelPage title="Test Adf faces table and applet">
    <af:panelHeader text="Orders">
    <af:table value="#{bindings.Orders.collectionModel}" var="row"
    rows="#{bindings.Orders.rangeSize}"
    first="#{bindings.Orders.rangeStart}"
    emptyText="#{bindings.Orders.viewable ? 'No rows yet.' : 'Access Denied.'}"
    id="orders" >
    <af:column sortProperty="order"
    headerText="#{bindings.Orders.labels.order}">
    <af:commandLink text="#{row.order}"
    id="orderNumber"
    onclick="showOrder(#{row.order})"
    disabled="false"/>
    </af:column>
                   </af:table>
    </af:panelHeader>
    <af:objectSpacer width="10" height="10"/>
    <af:panelBox>
    <f:verbatim>
    <div id="appletDiv">
                        <applet here />
                        </div>
    </f:verbatim>
    </af:panelBox>
    </af:panelHorizontal>
    </af:panelPage>
    </h:form>

    Sorry about the format, it looked okay when i previewed it , now it looks like terrible

  • Need a POP-UP which can display internal table data in ALV format

    HI All,
    I need to display INTERNAL TABLE values through a POP-UP. Only condition is that the window with the internal table data should be in ALV format and not in TEXT only format.
    To clarify, I used FM 'POPUP_WITH_TABLE_DISPLAY_OK'   and  'POPUP_WITH_TABLE_DISPLAY', but both display the data in TEXT format and there is no provision to put the FIELD names there. Everthing needs to be put into internal table and it displays it in text format.
    So I want a FM where I can display internal tabel data in ALV format( same format that would appear if you creata search help for a filed and output window would have all the ALV features like SORT buttons etc.
    Hope there is some FM to achieve this ALV format data thing.
    Thanks in advance for all your help.
    Regards
    FX3

    check this
    REPORT y_demo_alv_3.
    TYPE-POOLS: slis.
    DATA: BEGIN OF i_outtab OCCURS 0.
            INCLUDE STRUCTURE sflight.
    DATA:   w_chk TYPE c.                  "For multiple selection
    DATA: END OF i_outtab.
    *       I_OUTTAB TYPE SFLIGHT OCCURS 0,
    DATA: i_private TYPE slis_data_caller_exit,
          i_selfield TYPE slis_selfield,
          W_exit(1) TYPE c.
    PARAMETERS: p_title TYPE sy-title.
    START-OF-SELECTION.
      SELECT * FROM sflight INTO TABLE i_outtab.
      CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
           EXPORTING
                i_title                 = p_title
                i_selection             = 'X'
                i_zebra                 = 'X'
    *           I_SCREEN_START_COLUMN   = 0
    *           I_SCREEN_START_LINE     = 0
    *           I_SCREEN_END_COLUMN     = 0
    *           I_SCREEN_END_LINE       = 0
                i_checkbox_fieldname    = 'W_CHK'
    *           I_LINEMARK_FIELDNAME    =
    *           I_SCROLL_TO_SEL_LINE    = 'X'
                i_tabname               = 'I_OUTTAB'
                i_structure_name        = 'SFLIGHT'
    *           IT_FIELDCAT             =
    *           IT_EXCLUDING            =
    *           I_CALLBACK_PROGRAM      =
    *           I_CALLBACK_USER_COMMAND =
    *            IS_PRIVATE             = I_PRIVATE
         IMPORTING
                es_selfield             = i_selfield
                e_exit                  = w_exit
           TABLES
                t_outtab                = i_outtab
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc <> 0.
    *    MESSAGE i000(0k) WITH sy-subrc.
      ENDIF.
    *****the internal table is modified with a cross sign for marking the
    ***rows selected
      LOOP AT i_outtab WHERE w_chk = 'X'.
        WRITE: /  i_outtab-carrid, i_outtab-price.
      ENDLOOP.

  • Displaying the Selected Data in the Next Page Upon Selection????

    Hi,
    In my first page i have a list of data set in a displayTag with a
    radio button as a decorator. When the user clicks the a particular
    radiobutton the whole data (record) related to that radiobutton be selected and when the user clicks a button at the bottom the whole(selected data) should be transferred to the next page(jsp page). How
    to do this??? The displayTag is using a formbean . How to get the data
    from the selected record and populate it in the next page ???
    Please do provide an answer for this Since it is quite urgent...
    Thanks,
    --JavaCrazyLOVER                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    It all depends on how you have the data displayed in the table?
    If u have that information in Session (some kind of array), all you need to do is loop and then find the particular record and display it.

  • Trying to display an error message on my JSF page

    Hi,
    I'm very new to JSF and hopefully this will be easy to answer. I'm trying to display an error message when a user fails to login correctly. I have this on my login page:
    <h:message for="userid" id="inputError"></h:message>
    and in the login bean that handles the login, I invoke this method when the login fails, passing in the appropriate error string
         private void setError(String error) {
              FacesContext ctx = FacesContext.getCurrentInstance();
              FacesMessage fm = new FacesMessage();
              fm.setSeverity(FacesMessage.SEVERITY_ERROR);
              fm.setSummary(error);
              fm.setDetail("ERROR: " + error);          
              ctx.addMessage("userid", fm);
    But the error is not displaying upon a failed login and so I'm wondering if there is something more I need to do. Your help is appreciated, - Dave

    To get the "real" client id use
    ctx.addMessage(myComponent.getClientId(ctx), fm);and bind the userid input text to your backbean
    view code:
    <input binding="#{bean.myComponent}" ...backbean code:
    private UIInput myComponent;
    // getter/setter
    public UIInput getMyComponent() { return this.myComponent; }
    public void setMyComponent(UIInput myComponent) {
        this.myComponent = myComponent;
    }I hope this helps...

  • How to Display the table data ?

    Dear All ,
    Hi,
    i have a requirement that , i develop a one report program that contain one header and item internal table  values . Those header and item table details append to the final internal table(which contain all the header and item) . when i display the values all the the ticket_no will repeated.
    But client wants to display all the ticket_no will not  repeated. He wants output like..
    Please give me steps how to do this issue ?

    Dear Gopi,
    1) In decleration part you decleare like...!
        DATA: LT_SORT TYPE SLIS_T_SORTINFO_ALV,
                   WA_SORT TYPE SLIS_SORTINFO_ALV.
    2) Before  using ' REUSE_ALV_GRID_DISPLAY' Function module
           WA_SORT-FIELDNAME = 'TICK_NO'.
          APPEND WA_SORT TO LT_SORT.
         CLEAR WA_SORT.
    3) use FM : REUSE_ALV_GRID_DISPLAY. Like...!
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = 'X'
          I_CALLBACK_PROGRAM               = SY-REPID
    *   I_CALLBACK_PF_STATUS_SET          = ' '
    *   I_CALLBACK_USER_COMMAND           = ' '
          I_CALLBACK_TOP_OF_PAGE           = ''
    *   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *   I_CALLBACK_HTML_END_OF_LIST       = ' '
          I_STRUCTURE_NAME                 = LT_STRUCT
    *   I_BACKGROUND_ID                   = ' '
    *   I_GRID_TITLE                      =
    *   I_GRID_SETTINGS                   =
    *   IS_LAYOUT                         =
          IT_FIELDCAT                      = LT_FLDCAT
    *   IT_EXCLUDING                      =
    *   IT_SPECIAL_GROUPS                 =
        IT_SORT                          = LT_SORT
    *   IT_FILTER                         =
    *   IS_SEL_HIDE                       =
          I_DEFAULT                        = 'X'
    *   I_SAVE                            = ' '
    *   IS_VARIANT                        =
    *   IT_EVENTS                         =
    *   IT_EVENT_EXIT                     =
    *   IS_PRINT                          =
    *   IS_REPREP_ID                      =
    *   I_SCREEN_START_COLUMN             = 0
    *   I_SCREEN_START_LINE               = 0
    *   I_SCREEN_END_COLUMN               = 0
    *   I_SCREEN_END_LINE                 = 0
    *   I_HTML_HEIGHT_TOP                 = 0
    *   I_HTML_HEIGHT_END                 = 0
    *   IT_ALV_GRAPHICS                   =
    *   IT_HYPERLINK                      =
    *   IT_ADD_FIELDCAT                   =
    *   IT_EXCEPT_QINFO                   =
    *   IR_SALV_FULLSCREEN_ADAPTER        =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER           =
    *   ES_EXIT_CAUSED_BY_USER            =
        TABLES
           T_OUTTAB                         = LT_FINAL
       EXCEPTIONS
          PROGRAM_ERROR                    = 1
         OTHERS                           = 2 .
        May be it is solve your issue.
    Regards
    K. Chinna..

  • Get data from view and displaying the table data into Excel  pivot table

    Hi All,
    I have a small reqirement inthat When i get the data from the View that would displayed as Excel Pivot table.
    For displaying gerneral data to Excel I have followed Binarcy cachey
    Please suggest me in this.
    Thanks,
    Lohi.
    Message was edited by:
            Lohitha M

    Try this:
    http://download-west.oracle.com/docs/html/B25947_01/bcservices005.htm#sthref681
    Specifically code sample 8-10 for accessing the AM object.
    Then use the findView method to get a pointer to the VO.

  • Exporting MySQL table data to a file in location of choice

    Hi everyone,
    As I'm still not all too familiar with JDBC and MySQL, I'm running into a problem and I was hoping somebody could give me a push in the right direction. What I want to do is create a Java tool which performs a query on a database, to then return the results in a file on the user's computer, not on the mySQL server itself. I know that you can easily create a file using the
    SELECT * INTO OUTFILE
    command, but this creates a file on the MySQL server, not on the computer of the person running the Java tool. Basically I would like the program to have a 'browse' button, with which I can specify where the file should be saved. Can anybody tell me how I could possibly accomplish this? I was guessing something with the JFileChooser would be an option, but can't seem to find exactly how to code it.
    Thanks a lot for any input in advance, your help is greatly appreciated!
    best regards

    Thanks for your swift replies!
    I'm sorry I had the context mistaken, I thought as it was handling MySQL data, it would be related to the JDBC theme. But your answer has definitely helped me along, thanks for that! I will look at that tutorial you linked through... Am I right in assuming that I can run the query, save the results in the ResultSet rs variable and then pass this to the file opened/created by JFileChooser?
    Thanks again for your time!

Maybe you are looking for

  • Ovi Store and Wifi in Nokia E7

    When I try to download something from the Ovi Store using Wifi and the data connection from network off I get an error when I press download/buy. I don't get the error when data is turned on. This is normal or I have to reinstall Belle? Greetings fro

  • Using RAW images from Canon T3i in PSE 6

    I have a new Canon T3i which is set to create both RAW CR2 files and jpegs. How can I open the RAW files in Photoshop Elements 6? I've searched the internet for two hours now and can find no answer which seems unambiguous, short of buying the latest

  • Problem faced while configuring the domain configuration in WLS 10.0

    Hi all, I am trying to set up a Weblogic server 10.0 web application development environment in which we use persistence store, jms server, jms system module, subdeployments and jms system resources. when i configure everything and activate the chang

  • How much memory to run Logic 9 smoothly

    Hi all I'm the happy owner of a new iMac 21,5" since yesterday. Brilliant machine. It comes with 4GB of memory DDR3. Snow Leopard is the OS. I will be using it mainly to produce music, using Logic Studio 9. Is there any point on upgrading the memory

  • Is there a plug in yet to use photoshop elements 12 with nikon d750

    I want to use Photoshop Elements 12 with my Nikon D750. Is there a raw plug in yet ?