How to retrieve data from the HTML form in the JEditorPane?

I could quite easily use JEditorPane to render and display a simple HTML file.
My HTML looks like this:
<html>
<head>
<title> simple form</title>
</head>
<body bgcolor="cccccc">
<center><h1>SURVEY THING</h1>
</center>
<form id="survey">
<p>1.Type something in.</p>
<textarea cols=25 rows=8>
</textarea>
<BR>
<p>2.Pick ONLY one.</p>
<input type="radio" name="thing" value="0" Checked> NO choice <BR>
<input type="radio" name="thing" value="1"> First choice <BR>
<input type="radio" name="thing" value="2"> Second choice
<BR>
<p>3.Pick all you like.</p>
<input type="checkbox" name="stuff" value="A"> A <BR>
<input type="checkbox" name="stuff" value="B"> B <BR>
<input type="checkbox" name="stuff" value="C"> C <BR>
<input type="submit" value="give data">
<input type="reset" value="do clensing">
</form>
</body>
</html>
It gets diplayed fine and I can type in text, select radio buttons (they behave mutualy-exclusive,
as they should) and check checkboxes.
The problem I have is with retrieving the values which were entered into the form.
If I, after editing, try to write the html to the file using HTMLWriter,
it records the changes I made into the textarea, however all the radio and checkbox selections are lost.
Maybe the problem is that when I enter the values I do not use any methods like
insertBeforeStart and so on, but I believe I shouldn't need to use them to populate a form.
Especially I never change the structure of the HTML.
Also, when I try to traverse the Element tree and see the input elements attributes,
I can never see a change in the entered values. However it is probably b/c I am traversing through
the model and the changes are in the view (just a guess.)
Anyway, if anybody could direct me onto the right path: how to retrieve the values typed in the form,
or if it is possible at all in the JEditorPane, I would greatly appreciate.
thanks
maciej
PS. I have seen the answer to a similar question posted some time last year. However, I am trying
to find a soultion which allows forms/surveys to be built by people who have no java and only basic
html knwledge. And Axualize way is probably a little bit too "high-tech."

Maybe helpful for u.
import java.awt.*;
import java.awt.event.*;
import java.awt.Container;
import java.util.*;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.text.html.*;
public class TestHtmlInput extends JFrame {
     JEditorPane pane=new JEditorPane();
     public TestHtmlInput() {
          super();
          pane.setEditorKit(new HTMLEditorKit());
          pane.setText("<HTML><BODY><FORM>" +
          "<p>1.Input your name.</p>" +
          "<INPUT TYPE='text' name='firstName'>" +
          "<p>2.Input your information.</p>" +
          "<TEXTAREA rows='20' name='StationDescriptions' cols='100'>" +
          "<p>3.Pick ONLY one.</p>" +
          "<input type='radio' name='thing' value='0' Checked> NO choice <BR>" +
          "<input type='radio' name='thing' value='1'> First choice <BR>" +
          "<input type='radio' name='thing' value='2'> Second Choice <BR>" +
          "<p>4.Pick all you like.</p>" +
          "<input type='checkbox' name='stuff' value='A'> A <BR>" +
          "<input type='checkbox' name='stuff' value='B'> B <BR>" +
          "<input type='checkbox' name='stuff' value='C'> C <BR>" +
          "<p>5.Choose your nationality.</p>" +
          "<select name='natio'>" +
          "<option>12</option>" +
          "<option selected>13</option>" +
          "</select>" +
          "</FORM></BODY></HTML>");
          this.getContentPane().add(new JScrollPane(pane));
          JButton b=new JButton("print firstName text");
          b.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent e) {
                    System.out.println("Number of Components in JTextPane: " + pane.getComponentCount());
                    for (int i = 0; i <  pane.getComponentCount(); i++) {
                         //NOTE FOR BELOW: know its a Container since all Components inside a JTextPane are instances of the inner class
                         //ComponentView$Invalidator which is a subclass of the Container Class (ComponentView$Invalidator extends Container)
                         Container c = (Container)pane.getComponent(i);
                         //the component of this containers will be the Swing equivalents of the HTML Form fields (JButton, JTextField, etc.)
                         //Get the # of components inside the ComponentView$Invalidator (the above container)
                         Component swingComponentOfHTMLInputType = c.getComponent(0);
                         //each ComponentView$Invalidator will only have one component at array base 0
                         //DISPLAY OF WHAT JAVA CLASS TYPE THE COMPONENT IS
                         System.out.println(i + ": " + swingComponentOfHTMLInputType.getClass().getName());
                         //this will show of what type the Component is (JTextField, JRadioButton, etc.)
                         if (swingComponentOfHTMLInputType instanceof JTextField) {
                              JTextField tf = (JTextField)swingComponentOfHTMLInputType;
                              //downcast and we have the reference to the component now!! :)
                              System.out.println("  Text: " + tf.getText());
                              tf.setText("JTextField found!");
                         } else if (swingComponentOfHTMLInputType instanceof JButton) {
                         } else if (swingComponentOfHTMLInputType instanceof JComboBox) {
                                 JComboBox combo = (JComboBox)swingComponentOfHTMLInputType;
                                 System.out.println("  Selected index: " + combo.getSelectedIndex());
                            } else if (swingComponentOfHTMLInputType instanceof JRadioButton) {
                                 JRadioButton radio = (JRadioButton)swingComponentOfHTMLInputType;
                                 System.out.println("  Selected: " + new Boolean(radio.isSelected()).toString());
                         } else if (swingComponentOfHTMLInputType instanceof JCheckBox) {
                                 JCheckBox check = (JCheckBox)swingComponentOfHTMLInputType;
                                 check.setSelected(true);
                                 System.out.println("  Selected: " + new Boolean(check.isSelected()).toString());
                         } else if (swingComponentOfHTMLInputType instanceof JScrollPane) {
                              JScrollPane pane = (JScrollPane)swingComponentOfHTMLInputType;
                              for (int j=0; j<pane.getComponentCount(); j++) {
                                   //JTextArea area = (JTextArea)swingComponentOfHTMLInputType.getComponent(0);
                                   Container c2 = (Container)pane.getComponent(j);
                                   for (int k=0; k<c2.getComponentCount(); k++) {
                                        Component c3 = (Component)c2.getComponent(k);
                                        if (c3 instanceof JTextArea) {
                                             JTextArea area = (JTextArea)c3;
                                             System.out.println("  " + area.getClass().getName());
                                             System.out.println("     Text: " + area.getText());
                                             area.setText("JTextArea found!");
                         } else {
          this.getContentPane().add(b,BorderLayout.SOUTH);
     public static void main(String args[]) {
          TestHtmlInput app = new TestHtmlInput();
          app.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
          app.setSize( 400, 900 );
          app.setVisible( true );
}

Similar Messages

  • How to retrieve data from domain(Value Range)  of the table

    hi
    how to retrieve data from domain(Value Range)  of the table
    thanks

    Hello,
    You can try using the FM: DOMAIN_VALUE_GET TB_DOMAINVALUES_GET.
    BR,
    Suhas
    Edited by: Suhas Saha on Mar 24, 2009 10:08 AM

  • How to retrieve input data from a HTML form in the UTF-8 cha

    I encountered the following problem with a JWeb Application:
    I tried to write a JWeb-Application for OAS 4.0, that retrieves
    input data from a HTML form and writes it into an Oracle
    database.
    All processing should be done in the UTF-8 character set.
    The problem is, that the form data retrieved by getURLParameter
    are always encoded in a non-unicode character set and I found no
    way to change this.
    Can anybody tell me what I should do to get the form data in the
    UTF-8 character set?
    null

    Hi
    Try set in the JWEB application's Java environment such
    SYSTEM_PROPERTY: file.encoding=UTF8.
    Andrew
    Thomas Gertkemper (guest) wrote:
    : I encountered the following problem with a JWeb Application:
    : I tried to write a JWeb-Application for OAS 4.0, that
    retrieves
    : input data from a HTML form and writes it into an Oracle
    : database.
    : All processing should be done in the UTF-8 character set.
    : The problem is, that the form data retrieved by getURLParameter
    : are always encoded in a non-unicode character set and I found
    no
    : way to change this.
    : Can anybody tell me what I should do to get the form data in
    the
    : UTF-8 character set?
    null

  • How to retrieve data from URL or querystring in bsp pages

    hi
    how to retrieve data from URL or querystring in bsp pages.
    thanks
    Edited by: Vijay Babu Dudla on Mar 23, 2009 7:35 AM

    Hello Friend,
    Vijay is correct.
    REQUEST is a system object available in runtime of BSP application.
    It is the object of interface IF_HTTP_REQUEST.
    Use methof REQUEST -> GET_FORM_DATA( )
    Regards
    Krishnendu

  • How to Retrieve data from Variant Table

    Can anyone help me by telling how to retrieve data from variant table which was created by user. I am able to see data of variant table only thru cu60 transaction but not se11. I s there any function module to do this?

    Hello Mohan,
    if u already have data and u want to populate it in F4 help then use below code -
    u Have to make use of FM - 'F4IF_INT_TABLE_VALUE_REQUEST'
    REPORT  ZGILL_VALUE_REQUEST                     .
    data: begin of lt_all occurs 0.
            include structure DYNPREAD.
    data  end of lt_all.
    data: begin of lt_selected occurs 0.
           include structure DDSHRETVAL.
    data: end of lt_selected.
    DATA: BEGIN OF lt_code OCCURS 0,
                code LIKE zgill_main-PERNR,
          END OF lt_code.
    data no_dyn like sy-dynnr.
    Parameters : ECODE like zgill_main-PERNR.
    *parameters: pernr like pa0001-pernr .
    no_dyn =  sy-dynnr.   "give the scren no directly or sy-dynnr in case of report.
    At selection-screen on value-request for ECODE.
    select PERNR into table lt_code from zgill_main.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
          EXPORTING
            retfield               = 'ECODE'
            dynpprog               = sy-repid
           dynpnr                  = no_dyn
          dynprofield              =       'ECODE'
          window_title           = 'Employee Details'
           value_org              = 'S'
          DISPLAY                = 'F'
       TABLES
            value_tab             = lt_code
           RETURN_TAB             = lt_selected.
    EXCEPTIONS
      PARAMETER_ERROR        = 1
      NO_VALUES_FOUND        = 2
      OTHERS                 = 3
    *if sy-subrc eq '0' .
      write: 'success'.
    *endif.
    read   table lt_selected index sy-tabix.
    move lt_selected-fieldval to ECODE.

  • How to retrieve data from excel sheet

    Hi,
    How to retrieve data from excel sheet into a java file.

    janu05 wrote:
    If we append a $ in the end of the table name it is showing an error saying "invalid name,should not contain any invalid character or punctuation"Great, I'm very happy for you.
    Unless that was a question. In which case you might what to tell us a little more.
    Like which API you are using (assuming we are still on "reading an Excel sheet".

  • How to retrieve data from table(BOM_ITEM)

    Hi All,
    I wrote webservices using axis1.4 to get BOM information from SAP.. funtional module is CAD_DISPLAY_BOM_WITH_SUB_ITEMS
    webservices works fine..I'am able to retrieve data from Export Parameter..But not able to retrieve data from table
    How to retrieve data from table(BOM_ITEM)..?
    Cheers, all help would be greatly appreciated
    Vijay

    Hi,
    1. Create Page Process.
    2. Select Data Manipulation
    3. In category select "Automated Row Fetch"
    4. Specify process name, sequence, select "On Load - Before Header" in point.
    5. Specify owner, table, primary key, and the primary key column(Item name contains primary key).
    6. Create a process.
    7. In each item select "Database Column" in "Source Type".
    Regards,
    Kartik Patel
    http://patelkartik.blogspot.com/
    http://apex.oracle.com/pls/apex/f?p=9904351712:1

  • How to retrieve data from MDM using java API

    hi experts
    Please explain me the step by step procedure
    how to retrieve data from MDM using java API
    and please tell me what are the
    important classes and packages in MDM Java API
    thanks
    ramu

    Hi Ramchandra,
    You can refer to following links
    MDM Java API-pdf
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2d18d355-0601-0010-fdbb-d8b143420f49
    webinr of java API
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/89243c32-0601-0010-559d-80d5b0884d67
    Following Fourm Threads will also help.
    Java API
    Java API
    Re: usage of  java API ,
    Matching Record
    Need Java API for Matching Record
    Thanks and Regards,
    Shruti.
    Edited by: Shruti Shah on Jul 16, 2008 12:35 PM

  • How to combine data from different input forms outside a nested iView

    Hi,
    i try to combine data from different input forms in a single one.
    Because of space reasons in Flex compiling i already use nested iViews. Within these nested iViews its possible to use the 'combine' function to do this.
    But in the main iView I cant compose these function with other elements. I need to do this because of using these model in Guided Procedures with output parameters. These parameters I only get with a 'endPoint'. Unfortunatly its not possible to combine data from different input forms into the 'endPoint'.
    Is there any solution?
    Thanx
    Mathias

    Hi Scott,
    i tried this already and i also tried to map all parameters in the endpoint by drawing lines from the other forms and assign the 'empty parameters' by a formula.
    And when i create a collable object in GP and assign the VC iView, only the parameters of the parent-form (the form who trigger the event) are shown as output-parameters.
    Maybe any other ideas? I cant believe that such a simple thing is not possible?!?!
    In my opinion, thats a bug, that I'am not able to use the combine-operator in the main VC-iView. Whats your mind?
    greets
    mathias

  • I want to retrieve data from p0001-PLANS based on the below condition,

    Hi,
    I want to retrieve data from p0001-PLANS
    based on the below condition
    select stext from hrp1000 where plvar = '01' and otype = 'S' and objid = p0001-plans and begda GE pn-begda and endda LE pn-endda.
    Thanks,
    Rama.

    Hi
    Based on the Query you have specified thoise are stoerdin an Internal table- then
    select stext from hrp1000 into table t_hrp where plvar = '01' and otype = 'S' and objid = p0001-plans and begda GE pn-begda and endda LE pn-endda.
    The check table for this PLANS is T528B .
    if t_hrp[] is not intitial.
    select * from t528B intot table t_528 where plans eq t_hrp-plans.
    endif.
    Now you can get the PLANS data.
    Refer to the Text tbale for PLANS -  T528T
    To get the TEXTS -
    if t_hrp[] is not initial.
    select * from T528T into table t_528T where plans eq t_hrp-plans.
    endif.
    Regards
    Lekha

  • How to retrieve data from catsdb table and convert into xml using BAPI

    How to retrieve data from catsdb table and convert into xml using BAPI
    Points will be rewarded,
    Thank you,
    Regards,
    Jagrut BharatKumar Shukla

    Hi,
    This is not your requirment but u can try this :
    CREATE OR REPLACE DIRECTORY text_file AS 'D:\TEXT_FILE\';
    GRANT READ ON DIRECTORY text_file TO fah;
    GRANT WRITE ON DIRECTORY text_file TO fah;
    DROP TABLE load_a;
    CREATE TABLE load_a
    (a1 varchar2(20),
    a2 varchar2(200))
    ORGANIZATION EXTERNAL
    (TYPE ORACLE_LOADER
    DEFAULT DIRECTORY text_file
    ACCESS PARAMETERS
    (FIELDS TERMINATED BY ','
    LOCATION ('data.txt')
    select * from load_a;
    CREATE TABLE A AS select * from load_a;
    SELECT * FROM A
    Regards
    Faheem Latif

  • How to Retrieve data from database into another form ?

    Good Day!
    Am currently new at JSP. I've been studying it for awhile and still getting the hang of it. We are working on a project.
    Editing a given data. We have to retrieve the given data and post it to another form "Editing form".
    Since we can retrieve data using JSP but how are we going to post it to another form? I mean how are we going to transfer data from one form to another?
    Can anyone help me with codes please..

    The client is a web browser.
    The client submits a request (click a link, visit a form)
    The server gets to respond to this
    - look at request parameters from the client
    - access database
    - produce resulting html page
    - send page back to client.
    The standard pattern is to retrieve data from the database in java code, and then load that data into a bean.
    You then make that bean available as an attribute
    It is then available for use in your JSP - either <jsp:useBean> tag or using ${ELexpressions}
    All you can pass from the client to the server is request parameters - which are always strings.
    Draw a picture of where the information is, and the information flows. Very rarely does it go directly from one "form" to another.
    Cheers,
    evnafets

  • Oracle form: how to retrieve data from database to pop list

    I have problem in retrieving data from database to item list in
    oracle forms.
    Can anyone help me.
    thanks.

    The next is an example but you can find this information in
    Forms Help:
    DECLARE
         G_DESCS RECORDGROUP;
         ERRCODE NUMBER;
         rg_id RECORDGROUP;
         rg_name VARCHAR2(40) := 'Descripciones';
    BEGIN
         rg_id := FIND_GROUP(rg_name);
         IF Id_Null(rg_id) THEN
         G_DESCS := Create_Group_From_Query (rg_name, 'SELECT
    DESCRIPCION DESCRIPCION, DESCRIPCION DESC2 FROM FORMAS_PAGO);
         ERRCODE := POPULATE_GROUP(G_DESCS);
         POPULATE_LIST('FORMAS_PAGO.CMBDESCRIPCION',G_DESCS);
         END IF;
    END;
    Saludos.
    Mauricio.

  • How to retrieve data from database to the structure(complicated)

    Hello everyone:
           I want to retrieve data from database to the structure. but the structure defined like this below:
    TOLERANZOB LIKE QAMV-TOLERANZOB
    TOLERANZOB1 LIKE QAMV-TOLERANZOB
    so how can I retrieve the data from the database ? make sure that the two fields contain data both.
    Thanks in advance .
    Regards
    Nick

    Hi Nick,
    To retreive data for TOLERANZOB from QAMV,
    If you know the key fields then use
    SELECT SINGLE TOLERANZOB FROM QAMV INTO TOLERANZOB WHERE keyfields.
    else, you can use
    SELECT TOLERANZOB FROM QAMV UPTO ONE ROWS INTO TOLERANZOB WHERE....
    Once you retreive the data using the select query, you can check if it is initial and if not move the data from TOLERANZOB to TOLERANZOB1.
    <b>Reward points for helpful answers.</b>
    Best Regards,
    Ram.

  • How to retrieve data from inside the folders in SharePoint SSRS

    Hi ,
    How to get the data from inside the folders and subfolders.
    How can I do that.
    https://social.msdn.microsoft.com/Forums/en-US/15451351-4ee2-428c-a0b7-135810e4cbfa/action?threadDisplayName=ssrs-reports-sharepoint-list-datasource-how-to-retrieve-items-from-subfolders
    Here the information is not given.
    Regards
    Vinod

    Hi Vinodaggarwal87,
    According to your description, you want to retrieve data from sharepoint list in a sub folder. Right?
    In this scenario, we should select the XML data source type and in the connection string provide the
    List.asmx service URL when creating data source. Then we need to use the List web Service and specify "recursive" for ViewAttribute in Lists.asmx. For detail steps, please refer to the links below:
    Generate SSRS report on SharePoint List with folders using List Service.
    SSRS: how to specify ViewAttributes when creating a report against a SharePoint's list
    If you want to set the ViewAttribute on CAML query level. You need add the view tag outside of query tag:
    <View Scope="RecursiveAll">
        <Query>
            <Where>...</Where>
        </Query>
    </View>
    Reference:
    View Element (List)
    ViewAttributes Recursive Scope not working SharePoint 2013 CAML Query to fetch all files from document library recursively
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

Maybe you are looking for

  • Help with java

    I'm having a problem playing games on Pogo.com. When I click on a game it says I need to download Java. I click download, it says Apple has its own version and to update my software. Did that, doesn't work. I found this help article: https://help.ea.

  • Sequence periodoic Jobs

    Hello All, I have 3 jobs thats needs to run one after the other. Job A, Job B and job C. When Job A is complete Job B needs to trigger and then when job B is done Job C. I have set the Jobs in SM36, First i have set Job A witha time and date and sche

  • Vibration alarm level as a function of RPM

    I am working on the vibration panel for a machine with variable speed. The vibration alarm levels should be a function of the operating speed. Data Member Configuration screen accepts only constant values in the Alarm Condition box, HiHi, Lo, LoLo. 

  • Smart View Shared Connections - Oracle Essbase - How is list derived?

    Testing out the new build of Smart view 11.1.2.2.310 on Office Excel 2010.  In Shared connections I show three Essbase servers EssbaseCluster-1 EssbaseCluster-2 EssbaseCluster-3 Via EAS there is only EssbaseCluster-3.  What file or lookup is Shared C

  • JDEV Application does not comeup after spalsh screen

    Hi, Interested in JDeveloper, I recently installed JDeveloper from OTN website and after install and the first start, It checked for udpates and Then I installed udpated (10.1.3.1.0). After that it asked me to rename some file, but I missed the step