Using java to get table rows (jsp and html)?

I was wondering if there is any way to count rows from a html-table?
I want to know the number of rows created, just after it has been made. So that I can use this number 'for' creating my next table.
Have got this to work by using javascript code:
          function test2()
               if (!document.getElementsByTagName || !document.createTextNode) return;
          rows = document.getElementById('spesifikasjonsTabell').getElementsByTagName('tbody')[0].getElementsByTagName('tr');
          antallRader = rows.length;               
               document.test.hoyde.value = antallRader;
               return antallRader;
, but this only generates on the clientside; which is not what I want.
I got a webpage, that uses html and jsp. After the generation of a table - which has an unknown numbers of rows, because of several underlying tests - I'd like to retrive how many rows that was generated before I proceed with my next table.
Is there a good workaround to this problem?
P�l
Message was edited by:
paulOlsen

Hey there, and thanks for fast response.
Allready tried that code earlier. Works great on displaying the var 'row'-s inside, for instance, a <input type="text" or as a pup-up on a alert();
The javascript works on the client-side, so I have no way of using that code for further testing in codes for my viewing; at least I can't think of any.
The thing is that:
1) I can't use an 'onClick', since the next table should be generated without any human interference.
2) I used the same code to get the number of rows when I sat the table inside a form. But then, when calling the javascript function, I have no way to retrieve the linenumbers for use to test ON the next table.
Since I'd have to use, say a field name <input type hidden="rows".., a method to call this very "rows" in jsp:
<table>
<!-- lots of rows -->
</table>
<%
int numberOfRows = request.Parameter("rowcount") or what ever; here is where I need the 'number of rows'
// let's just say int here though a String
if(numberOfRows < 35)
%>
<table>
<!-- Im including this table if the test above occurs -->
</table>
<%
else
%>
<!-- if this occurs, then I'd like to do something else -->
<%
%>
Any ideas?
P�l
Message was edited by:
paulOlsen
null

Similar Messages

  • Whenever I use something which uses Java (for example, an online game) and then click the address bar, it seems that the address bar is disabled.

    Whenever I use something which uses Java (for example, an online game) and then click the address bar, it seems that the address bar is disabled. I cannot highlight or type in the address bar unless I interact with another program and then switch back to Firefox. When I interact with Java again, the same problem persists! Help!
    Sorry, I didn't know what category this should be under, but it's urgent.

    Perform the suggestions mentioned in the following articles:
    * [https://support.mozilla.com/en-US/kb/Template:clearCookiesCache/ Clear Cookies & Cache]
    * [[Troubleshooting extensions and themes]]
    Check and tell if its working.
    Some of your Firefox Plugins are out-dated
    * Update All your Firefox Plugins -> [https://www.mozilla.org/en-US/plugincheck/]
    * '''When Downloading Plugins Update setup files, Remove Checkmark from Downloading other Optional Softwares with your Plugins (e.g. Toolbars, McAfee, Google Chrome, etc.)'''

  • When I try to use Safari, I get a screen flash and then it closes.  How can I fix this?

    When I try to use Safari, I get a screen flash and then it closes.  How can I fix this?

    1. Double-click the Home button to close all Inactive Apps in Task Bar
    2. Hold the Apps in Task Bar down for a second or two until you see the minus sign
    3. Tap the minus sign to close Apps
    4. Tap center of screen to return to Home Screen
    5. Reset iPad. Hold the Sleep and Home button down for about 10 second until you see the Apple logo. Ignore the red slider

  • Anyone knows about using java to get data from MS Access database.

    hi there
    anyone knows about using java to get data from MS Access database? thank you

    there is a list of jdbc drivers at:
    http://industry.java.sun.com/products/jdbc/drivers
    they have several ms access drivers listed.
    also, you can use a jdbc-odbc bridge which allows you to use jdbc to connect to any odbc data source:
    http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/bridge.doc.html

  • Table rows acting like HTML TD Links

    Guys, Anyway to have our Answers Table rows act like HTML Table <TD> Links?
    I have not tried it yet but was planning to create HTML links in Table Rows, read those into Answers and see if that will work. Thought i ask people here if they have done anything like that?
    Thanks in advance for any pointers.
    Regards,

    I am not sure what you mean by table link.
    If you mean a report with links in one column you can do the following:
    1. Create your report and an extra column as placeholder
    2. Go into the fx of this column and tick "custom headings"
    3. Insert your html link which can be a mixture of static text and values from the report and don't forget in the end of the link to define what text to display for the link in the report
    In my case it is a link to google maps which I feed with city and street data from the report and in the report the city is displayed.
    '<x target="blank" href="http://maps.google.de/maps?f=q&hl=de&mrt=loc&z=15&q='|| customer.city ||'+'|| customer.street ||'">' || customer.city ||'</x>
    Replace the "x" at the beginning and end with an "a" and don't miss the ' at the very beginning
    regards
    Turalf

  • FF table row spacing and footer margins

    Two things happen in FF only. 1) My table rows 1,3 & 5
    are larger than they should be.
    http://www.wholesalebingosupplies.com/family-gatherings.html
    2) My footer margins are completely reduced.
    I tried adding lines and paragraphs (which I don't like
    doing) which worked but of course made IE6 and IE7 look awful
    because of the additional spaces. I also tried different options
    with my div tag but was not able to come up with a solution.
    I eventually want to use .css and get rid of the tables but
    for now, I don't have the confidence with my css skills.
    Any advice is greatly appreciated.

    andrewpndavies wrote:
    Anyone know how to add a page break to a long table which spans several pages ?
    No such a feature in Pages but it is the standard behaviour in Numbers so it may be a good soluce to move your document from Pages to Numbers as I often wrote (and often do).
    Yvan KOENIG (from FRANCE mercredi 22 avril 2009 14:10:17)

  • Read the table row data and dispaly it in the ME21n transaction

    Hi All,
    i'm new to ABAP and OO ABAP .Please somebody help me out for my req. My req is , when i double click on the table row which is having PO details , then that data  should be displayed in the ME21n transaction. please some on tell me how to achive this using SALV class..
    thanks,
    Rajeev.

    Hi rajeev bikkani ,
    you can use the events 'Double_click' in alv. below given the code, try out.
    class lcl_list_event_handler definition.
    PUBLIC SECTION.
    methods on_double_click
          for event double_click of cl_gui_alv_grid
            importing e_row .
    endclass.
    class lcl_list_event_handler implementation.
    method on_double_click.
    call transaction 'ME21N'.
    ENDMETHOD.
    ENDCLASS.
    before executing the method SALV.
    write code    
      set handler obj2(reference for lcl_list_event_handler) ->on_double_click
                    for obj1(referenece for cl_gui_alv_grid).

  • PDF created using Java iText package - Text not editable and not displaying font properties on Acrobat

    Hi,
    I have an issue in editing the text and viewing the font properties of a text region on a PDF created using Java iText package.
    I use Adobe Acrobat 9 Pro Extended and the option Tools -> Advanced Editing -> TouchUp Text Tool.
    The strange behaviour is that, I have 2 PDFs created out of the same base PDF and text added via Java iText package with the same Text, Font and other properties.
    One of the PDF has the text region editable on Acrobat but the other one has the text region which is not editable.
    But both the PDFs are editable via Adobe Illustrator.
    I have attached both the PDFs for your reference
    PDF_Editable.pdf - Editable on Acrobat
    PDF_Not Editable.pdf - Not Editable on Acrobat
    Any help or insight to find out the difference/issue with the PDF which is not editable via Acrobat would be appreciated.
    Thanks in advance.
    Regards,
    Madhusoodhan Henryraman

    You don't have direct control of the leading of a multiline text field. A common approach is to control the background color of the field with JavaScript since the lines are not really needed when the field is used in Reader/Acrobat. They may be useful when using the form by hand. For more information, see the posts by Max in this topic: http://acrobatusers.com/forum/forms-acrobat/how-do-i-use-multi-lined-text-fields-over-prin ted-line-area-existing-form

  • Get Table Row Count

    hi folks,
    How to get a tables' row count (number of records)?
    Values of table are filled by an RFC return structure. Or how can we get the number of records in the RFC return structure?
    thanks in advance
    nikhil

    Hi,
    Check the size of the node bound to the table
    lets say orders is the node bound to the table
    //Replace orders with the node bound to your table.
    wdContext.nodeOrders().size();
    Regards
    Ayyapparaj

  • Java applet was loaded in JSP as HTML.

    I was running my web application in Linux platform. I have the lastest mozilla broswer which is 1.7.1. I was installed the Java plugins which this can be proved by i was able to load ICQ2Go of ICQ.com. The Java applet i created was loaded correctly in .html file. Unfortunately the Java applet was not load in .jsp file and a window was pop up to prompt me to go java.sun.com to donwload the proper plugin to view the applet which the link is http://java.sun.com/products/plugin/?application/x-java-applet;. I need help. Please give me a hand. Thank you.
    Coding to load Java applet in .jsp
    <HTML>
    <HEAD>
    <TITLE>Applet In Broswer</TITLE>
    </HEAD>
    <BODY>
    <H1>Applet in Broswer</H1>
    Fibonacci Test in Java Applet.
    <jsp:plugin type="applet" code="foo.FibonacciTest.class" width="800" height="300" >
    </jsp:plugin>
    </BODY>
    </HTML>Coding to load Java applet in .html
    <HTML>
    <HEAD>
    <TITLE>Applet In Broswer</TITLE>
    </HEAD>
    <BODY>
    <H1>Applet in Broswer</H1>
    Fibonacci Test in Java Applet.
    <APPLET CODE="foo.FibonacciTest.class" WIDTH=800 HEIGHT=300>
    </APPLET>
    </BODY>
    </HTML>

    Whoops.. I even make a mistaken on the title of my problem - should be is Java applet was not loaded in JSP as HTML. The problem was solved. Thanks for anyone who had view this.

  • Character Encoding for JSPs and HTML forms

    After having read loads of postings on character encoding problems I'm still puzzled about the following problem:
    I have an instance (A) of WL 8.1 SP3 on a WinXP machine and another instance (B) of WL 8.1 without any SP on a Win2K machine. The underlying Windows locale is english(US) in both cases.
    The same application deployed as a war file to these instances does not behave in the same way when it comes to displaying non-Latin1-characters like the Euro symbol: Whereas (A) shows and accepts these characters as request-parameters, (B) does not.
    Since the war file is the same (weblogic.xml, jsps and everything), the reason for this must either be the service-pack-level or some other configuration setting I overlooked.
    Any hints are appreciated!

    Try this:
    Prefrences -> Content -> Fonts & Color -> Advanced
    At the bottom, choose your Encoding.

  • Quikly table row update and freeze ui

    Hello forum,
    I'm trying update tableview by observablelist with 500 ms frequency. Using this interval the UI freeze.
    Can u help me pls?

    Sorry for late...
    this is the code I'm using:
    public class AlarmTableFactory {
        private final TableView<Alarm> table;
        class DataTableCell<T> extends TableCell<Alarm, T> {
            @Override
            protected void updateItem(T t, boolean empty) {
                super.updateItem(t, empty);
                if (!empty && getTableRow() != null) {
                    int row = this.getTableRow().getIndex();
                    Alarm alarm = getTableView().getItems().get(row);
                    setStyle(alarm.getlevel().getColor());
                    setTextFill(alarm.getlevel().getTextFillColor());
                    setText(String.valueOf(t));
        public AlarmTableFactory() {
            table = new TableView<Alarm>();
        public TableView<Alarm> createTable() {
            final Field[] fields = Alarm.class.getDeclaredFields();
            for (int i = 0; i < fields.length; i++) {
                final int count = i;
                final TableColumn<Alarm, String> col = new TableColumn(fields.getName().toUpperCase());
    col.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<Alarm, String>, ObservableValue<String>>() {
    private ReadOnlyObjectWrapper ro;
    @Override
    public ObservableValue<String> call(TableColumn.CellDataFeatures<Alarm, String> cellDataFeature) {
    try {
    Alarm alarm = cellDataFeature.getValue();
    Method method = alarm.getClass().getMethod("get" + fields[count].getName(), null);
    try {
    ro = new ReadOnlyObjectWrapper((String) method.invoke(alarm, new Object[0]));
    } catch (ClassCastException ex) {
    // col.setVisible(false);
    catch (IllegalAccessException ex) {
    Logger.getLogger(AlarmTableFactory.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IllegalArgumentException ex) {
    Logger.getLogger(AlarmTableFactory.class.getName()).log(Level.SEVERE, null, ex);
    } catch (InvocationTargetException ex) {
    Logger.getLogger(AlarmTableFactory.class.getName()).log(Level.SEVERE, null, ex);
    } catch (NoSuchMethodException ex) {
    Logger.getLogger(AlarmTableFactory.class.getName()).log(Level.SEVERE, null, ex);
    } catch (SecurityException ex) {
    Logger.getLogger(AlarmTableFactory.class.getName()).log(Level.SEVERE, null, ex);
    return ro;
    col.setCellFactory(new Callback<TableColumn<Alarm, String>, TableCell<Alarm, String>>() {
    @Override
    public TableCell<Alarm, String> call(TableColumn<Alarm, String> arg0) {
    return new DataTableCell();
    table.getColumns().add(col);
    table.setCache(false);
    return table;
    And this other code for update table with listenerpublic class AlarmTableController implements MapMarkerAlarmListener {
    private final TableView<Alarm> table;
    public AlarmTableController(TableView<Alarm> table) {
    this.table = table;
    @Override
    public void mapMarkerAlarmed(ALARM_LEVEL alarmLevel, MapMarker marker) {
    final ObservableList<Alarm> row = FXCollections.observableArrayList();
    Alarm alarm = new Alarm("", "---", "", "");
    row.addAll(alarm);
    table.getItems().addAll(row);
    alarm = null;
    Thanks in advanced,
    palban                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Can a Servlet be used for Storing Objects with both JSP and JSF used on it?

    Hi,
    Pages I have:
    SearchEmployee.jsp
    This page has a search engine that search out the Employee. This Employee Object will be stored inside a Servlet(controller) for future references by other pages. I used JSP, html tags for forms, and request.getParameter() to built this search engine.
    Problem:
    I have a JSF Form that wants to DISPLAY the employee which I have found in my Search Engine. How can I get the JSF's value="#{Controller.employeeObj.name}" to get the value from the object?
    This seems logical as my JSF form is just retrieving the stored object in the Controller. I currently cant seem to output it

    The servlet shouldn't be used to store ANY data, let alone data to be accessed by other sevlets. Put the object into the Session object.

  • Display the background of table row alternatively and hiding cell border

    Hi all,
    I am trying to display the background of the table using different color alternative and at same time I need to hide the border of all cells.
    What I found in <af:table> is using bandingInterval="1" banding="row", but how can I set the background color? And how to hide the cell border?
    Or if there is a thing like row index so that I can mod it like rowIndex%2==0 in every column to determine the inlineStyle?
    Thanks.
    Shawn

    <af:table value="..." var="row" varStatus="status">
      <af:column inlineStyle="#{status.index % 2 > 0.5 ? 'border:none;' : ''}">
      </af:column>
    </af:table>For some reason, EL operation always seems to return a double, so the condition has to be defined with that in mind.
    Regards,
    ~ Simon

  • How to retrieve table rows data and add into DB

    Hi All,
    I'm a beginner in JAVAFX, I have developed a table and adding the data into the table in multiple rows. on button click I would like these rows to be added into DB.
    Please could anyone help on this. I'm copy the code for reference.
    CODE:
    import javafx.ext.swing.SwingComponent;
    import javax.swing.event.ListSelectionEvent;
    import javax.swing.event.ListSelectionListener;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.table.DefaultTableModel;
    package class TableColumn{
    public var text: String;
    package class TableCell{
    public var text: String;
    public var id;
    public var str:String;
    public var str1:String[];
    public var num:Number;
    package class TableRow{
    public var cells: TableCell[];
    package class SwingTable extends SwingComponent{
    var table: JTable;
    var model:DefaultTableModel;
    public var selection: Integer;
    public var columns: TableColumn[] on replace{
    model = new DefaultTableModel(for(column in columns) column.text, 0);
    table.setModel(model);
    public var rows: TableRow[] on replace oldvalue[lo..hi] = newVals{
    for(index in [hi..lo step -1]){
    model.removeRow(index);
    for(row in newVals){
    model.addRow(for(cell in row.cells) cell.text);
    public override function createJComponent(){
    table = new JTable();
    model = table.getModel() as DefaultTableModel;
    var selectionModel = table.getSelectionModel();
    selectionModel.addListSelectionListener(
    ListSelectionListener{
    public override function valueChanged(e: ListSelectionEvent ) {
    selection = table.getSelectedRow();
    return new JScrollPane(table);
    }

    Instead of using a combo box, using a text ring makes it much easier to disable items in the list. Here is a vi that will do what you want. Also you can delete the last element in the table and make it enabled in the text ring for selecting again.
    - tbob
    Inventor of the WORM Global
    Attachments:
    test_table[1].vi ‏75 KB

Maybe you are looking for