How can an applet retrieve the values of a HTML form shown in a JEditorPane

Hi,
I'm doing an applet that contains a JTree and a JEditorPane
among other components. Each node of the JTree represents some
information that is stored in a database, and whenever a JTree
node is selected, this information is recovered and shown in
the JEditorPane with a html form. To make the html form,
the applet calls a servlet, which retrieves the information of
the node selected from the database. This information is stored
like a XML string, and using XSLT, the servlet sends the html
form to the applet, which shows it in the JEditorPane.
My problem is that I don't know how I can recover new values
that a user of the application can introduce in the input fields
of the html form. I need to recover this new values and send them
to another servlet which store the information in the database.
If someone could help me I'd be very pleased.
Eduardo

At least I found a fantastic example. Here it is:
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.net.*;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.text.html.*;
public class FormSubmission extends JApplet {
private final static String FORM_TEXT = "<html><head></head><body><h1>Formulario</h1>"
+ "<form action=\"\" method=\"get\"><table><tr><td>Nombre:</td>"
+ "<td><input name=\"Nombre\" type=\"text\" value=\"James T.\"></td>"
+ "</tr><tr><td>Apellido:</td>"
+ "<td><input name=\"Apellido\" type=\"text\" value=\"Kirk\"></td>"
+ "</tr><tr><td>Cargo:</td>"
+ "<td><select name=\"Cargo\"><option>Captain<option>Comandante<option>General</select></td>"
+ "</tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"Enviar\"></td>"
+ "</tr></table></form></body></html>";
protected HashMap radioGroups = new HashMap();
private Vector v = new Vector();
public FormSubmission() {
getContentPane().setLayout(new BorderLayout());
JEditorPane editorPane = new JEditorPane();
editorPane.setEditable(false);
editorPane.setEditorKit(new HTMLEditorKit()
public ViewFactory getViewFactory() {
return new HTMLEditorKit.HTMLFactory() {
public View create(Element elem) {
Object o = elem.getAttributes().getAttribute(javax.swing.text.StyleConstants.NameAttribute);
if (o instanceof HTML.Tag)
HTML.Tag kind = (HTML.Tag) o;
if (kind == HTML.Tag.INPUT || kind == HTML.Tag.SELECT || kind == HTML.Tag.TEXTAREA)
return new FormView(elem)
protected void submitData(String data)
showData(data);
protected void imageSubmit(String data)
showData(data);
// Workaround f�r Bug #4529702
protected Component createComponent()
if (getElement().getName().equals("input") &&
getElement().getAttributes().getAttribute(HTML.Attribute.TYPE).equals("radio"))
String name = (String) getElement().getAttributes().getAttribute(HTML.Attribute.NAME);
if (radioGroups.get(name) == null)
radioGroups.put(name, new ButtonGroup());
((JToggleButton.ToggleButtonModel) getElement().getAttributes().getAttribute(StyleConstants.ModelAttribute)).setGroup((ButtonGroup) radioGroups.get(name));
JComponent comp = (JComponent) super.createComponent();
// Peque�a mejora visual
comp.setOpaque(false);
return comp;
return super.create(elem);
//editorPane.setText(FORM_TEXT);
editorPane.setText(texto);
getContentPane().add(new JScrollPane(editorPane), BorderLayout.CENTER);
private void showData(String data) {
     // ergebnis significa resultado
StringBuffer ergebnis = new StringBuffer("");
StringTokenizer st = new StringTokenizer(data, "&");
while (st.hasMoreTokens()) {
String token = st.nextToken();
String key = URLDecoder.decode(token.substring(0, token.indexOf("=")));
String value = URLDecoder.decode(token.substring(token.indexOf("=")+1,token.length()));
v.add(value);
ergebnis.append(" "); ergebnis.append(key); ergebnis.append(": "); ergebnis.append(value); ergebnis.append(" ");
ergebnis.append(" ");
JOptionPane.showMessageDialog(this, ergebnis.toString());
public static void main(String[] args) throws Exception {
JFrame frame = new JFrame ();
FormSubmission editor = new FormSubmission ();
frame.getContentPane().add(editor);
frame.pack();
frame.show();
}

Similar Messages

  • Loaded iPhoto 9.2, my 7200 photos grew to 113,000 files with screen shots, duplicates, ,5-10copies of faces and apple has no way to eliminate this. How can I ever retrieve the original 7200 from this mess?

    Loaded iPhoto 9.2, my 7200 photos grew to 113,000 files with screen shots, duplicates, ,5-10copies of faces and apple has no way to eliminate this. How can I ever retrieve the original 7200 from this mess?

    This can happen if the HD icon is inadvertently dragged to the iPhoto Window.
    Easiest solution: restore from your back up.
    Regards
    TD

  • How Can I get all the values of a DBMS package?

    Hi all
    I'm using this "dbms_output.put_line(DBMS_DB_VERSION.VERSION || '.' ||DBMS_DB_VERSION.RELEASE);" to show the version. But how Can I get the all the values from DBMS_DB_VERSION ? Is there a common way ?
    Thanks .
    Best
    Laurence

    Hi,
    Don't think that's possible. Even if it were, you wouldn't be able to use/display BOOLEAN type in SQL.
    If you just aim to see what they are, you could do something like this
    select text
      from all_source
    where owner = 'SYS'
       and name = 'DBMS_DB_VERSION'
       and type = 'PACKAGE';Or even
    select dbms_metadata.get_ddl('PACKAGE', 'DBMS_DB_VERSION', 'SYS') from dual;My version is:
    SQL> select * from v$version where rownum = 1;
    BANNER                                                         
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    1 row selectedIn 11g you also have [PL/SCOPE|http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10471/adfns_plscope.htm#ADFNS02203] which might help you even more.
    Regards
    Peter

  • How can i get the value from a HTML Form

    hi,
    I am using HTML form (logfrm). there are userId field,password field, submit button,reset button, and a link.
    when i click on the link, it should fetch the value of userid.
    How it is possible?
    AE

    use jsp:
    which lets you embed java statments in your html -so you when you click on the link you can use request.getParameter("userID") to get the userid.
    Ideally with html forms use a combination of jsp and java beans, where the fields in the form are also fields in your java bean, which you can access through setters and getters.
    google for some jsp tutorials.

  • How can I logically insert the value of a range of cells in other cells??

    I have a column A with many values.
    I would like the value of A1 in B1, the value of A2 in C1, the value of A3 in D1, the value of A4 in E1. All very doable, but ...
    I would then like for value of A5 in B2, the value of A6 in C2, the value of A7 in D2, the value of A8 in E2, and
    the value of A9 in B3, the value of A10 in C3, etc.
    How does one achieve this?

    Hi,
    You can do it with an AppleScript:
    tell application "Numbers" to tell front document to tell sheet 1 to tell table 1
      set row_count to (count rows)
      set row_tracker to 1
      repeat with y from 1 to row_count
      set nu_col to (y mod 4) + 1
      if nu_col is 1 then set nu_col to 5
      set source_cell to cell 1 of row y
      set target_cell to cell nu_col of row row_tracker
      set value of target_cell to value of source_cell
      set value of source_cell to missing value
      if nu_col is 5 then set row_tracker to row_tracker + 1
      end repeat
    end tell

  • How can I find out the value of my giftcard without redeeming it? It is a gift for a friend.

    I do not know if the itunes giftcard i currently have has been activated and can be redeemed. I cannot redeem it to my acount because it is a gift for a friends birthday, and doing so would transfer the value of the card into my account. Is there anyway to find out it is has been activated and can be used??

    Call 1-888-320-3301 and follow the instructions. You can also see your balance by visiting the account area of the online Apple Store online.

  • How can I define that the value of a column should always be in UPPER case

    Hi,
    I want to make sure that the value in a column is always in UPPER case.
    Can we give this condition while creating or altering a table.
    A trigger can do it easily, but I was wondering if we could define a column to have values with upper case all the time, independent of what values are inserted. I mean if we give a lower case value in the insert statement, it should be converted automatically to upper case & stored.
    I want something like
    Alter table MY_TABLE Modify ( col1_upper varchar2(25) default UPPER(Col1_upper));
    But the above statement does not work as it references the col of the table.
    Thanks
    Sunil

    Well, you can put a check constraint on to prevent someone from putting lowercase data in:
    alter table my_table add constraint my_table_check_upper check (col1_upper = upper(col1_upper));However, I know of no way to modify the data being inserted/updated in a table without a trigger.
    Richard

  • How can I programmatically retrieve the CVI Target Version Settings (e.g. File Version, Copyright, etc) in my CVI application?

    Is there any way that I can programmatically retrieve the CVI Target Version Settings (e.g. File Version, Copyright, etc) in my CVI application?
    I am using LabWindows/CVI version 7.0.
    The settings that I'd like to retrieve within my application are those that are set under Build | Target Settings... | Version Info...
    e.g.
          File Version
          Product Version
          Company Name
          Legal Copyright
    Thanks,
    Darren
    Message Edited by Darren Draper on 01-16-2006 02:03 AM

    Well, "File access permission denied" claims for an authorization problem . I suggest you double check file attributes in the project directory: it could be that you have downloaded this example from a CD and the read-only attribute has not been cleared.
    The library does not reside in the example folder: as you can see by selecting View >> Show full pathnames in the project window, it should be in ....CVI\sdk\lib folder.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How can I to obtain the value selected in a search help?

    Hi Gurus,
    I have a search help and it has a "search help exit" (a FM).
    At FM search help exit I am calling the standard FM RHF4_RFC_FIELD_VALUE_REQUEST to another system ( assigning the corresponding "destination" ).
    The FM RHF4_RFC_FIELD_VALUE_REQUEST display a screen where the search is done. When a field is selected returns the values in the internal table RETURN_TAB.
    At FM search help exit I assign the selected value ( in RETURN_TAB ) to internal table's field RECORD_TAB-STRING.
    The search help is assigned to a table field and when I want to obtain a value through search help in SM30 transaction, the screen created by FM RHF4_RFC_FIELD_VALUE_REQUEST appears, but when I select a value, this is not "copy" to the table field.
    In what am I wrong? What am I omitting?
    Thanks

    Hi,
    Probably you are not mapping the right fields from source to destination structures.
    plz check RETURN_TAB-STRING(this is an example) assigned to RECORD_TAB-STRING.
    put a break point at this line and check.
    Thanks,
    Sree.

  • How to get the values from a html form embedded in a swing container

    Hi all,
    I am developing an application in which i have to read a html file and display it in a swing container.That task i made it with the help of a tool.But now i want to get the values from that page.ie when the submit button is clicked all the values of that form should be retrived by a servlet/standalone application.I don't know how to proceed further.Any help in this regard will be very greatful
    Thanks in advance,
    Prakash

    By parsing the HTML.

  • How can I get all the values of a String array profile property using javascript?

    I am trying to build functionality into our site that records all products added to the basket against a user's profile.
    I have so far been able to store the product codes against the profile as a property using Ajax:
           var dataString = ":formid=addProduct&:formstart=/apps/thread/templates/page_product/jcr:content/par/produc t/formstart&:redirect=/content/thread/en/user/cart.html&productId=151515:profile="+profile ;
                         $.ajax({ 
                type: "POST", 
                url: "/content/women/evening/dresses/l-k-bennett-davinadress.html", 
                data: dataString, 
                success: function(data) { 
    In this example I have hardcoded a product ID of 151515.
    In order to save the property as a multi string field you simply replace &productId=151515 with &productId=151515&productId=131313&productId=141414 or as many extra values as you want to build into that string. This stores a productId property against a user profile.
    The issue comes from calling that data back. Using var value = CQ_Analytics.ProfileDataMgr.getProperty("productId") I can get the first value of this array (or the single value if only one is stored).
    However there does not seem to be a way to get any of the other stored values in the array using getProperty. Does anyone know how I can achieve this?

    Hi,
    Don't think that's possible. Even if it were, you wouldn't be able to use/display BOOLEAN type in SQL.
    If you just aim to see what they are, you could do something like this
    select text
      from all_source
    where owner = 'SYS'
       and name = 'DBMS_DB_VERSION'
       and type = 'PACKAGE';Or even
    select dbms_metadata.get_ddl('PACKAGE', 'DBMS_DB_VERSION', 'SYS') from dual;My version is:
    SQL> select * from v$version where rownum = 1;
    BANNER                                                         
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    1 row selectedIn 11g you also have [PL/SCOPE|http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10471/adfns_plscope.htm#ADFNS02203] which might help you even more.
    Regards
    Peter

  • How to retrieve the values from a LinkedList

    Hello,
    I have just put this question in java programming forums by mistake...I think that it should be here ...
    I have created a LinkedList to store the results of a query to a database.
    These reasults are decimal numbers and then I want to sum all these numbers to be able to make the average.
    But when I try to retrieve the values of the Linked List I always receive an incopatible types error..
    Here is an extract of my code in a jsp page.
    LinkedList Average = new LinkedList();
    String Media = rst.getString(10);
    Average.add(Media);
    int Size = Average.size();
    double Sum = 0.0;
    for (int i=0; i<=Size; i++)
                    double Result = Average.get(i)     
                  Sum = Sum + Result;
    }If I try to retrieve the value of only one node from the list , I can just putting <%=Average.get(i)%>...but..how can I retrieve all the values (they are decimal numbers) to be able to add them?

    If you want to sum all the values, is there any reason you just don't retrieve the sum from the database rather than the list of values?
    anyway
    List average = new LinkedList();
    while (rst.next()){
      // retrieve the number:
      String mediaString = rst.getString(10);
      Double media = Double.valueOf(mediaString);
      // or maybe like this if it is a number in the database
      Double media = new Double(rst.getDouble(10));
      average.add(media);
    doubleSum = 0.0;
    for (Iterator it = average.iterator(); it.hasNext(); ){
      Double result= (Double) it.next();
      doubleSum += result.doubleValue();
    }

  • How to retrieve the values from a table if they differ in Unit of Measure

    How to retrieve the values from a table if they differ in Unit of Measure?

    If no data is read
    - Insure that you use internal code in SELECT statement, check via SE16 desactivating conversion exit on table T006A. ([ref|http://help.sap.com/saphelp_nw70/helpdata/en/2a/fa0122493111d182b70000e829fbfe/frameset.htm])
    If no quanity in result internal table
    - There is no adqntp field in the internal table, so no quantity is copied in itab ([ref|http://help.sap.com /abapdocu_70/en/ABAPINTO_CLAUSE.htm#&ABAP_ALTERNATIVE_1@1@]).
    - - Remove the CORRESPONDING, so quantity will fill the first field adqntp1.  ([ref|http://help.sap.com/abapdocu_70/en/ABENOPEN_SQL_WA.htm])
    - - Then loop at the internal table and move the quantity when necessary to the 2 other fields.
    * Fill the internal table
    SELECT msehi adqntp
      INTO TABLE internal table
      FROM lipso2
      WHERE vbeln = wrk_doc1
        AND msehi IN ('KL','K15','MT').
    * If required move the read quantity in the appropriate column.
    LOOP AT internal_table ASSIGNING <fs>.
      CASE <fs>-msehi.
        WHEN 'K15'.
          <fs>-adqnt2 = <fs>-adqnt1.
          CLEAR <fs>-adqnt1.
        WHEN 'MT'.
          <fs>-adqnt3 = <fs>-adqnt1.
          CLEAR <fs>-adqnt1.
      ENDCASE.
    ENDLOOP.
    - You could also create another table with only fields msehi and adqntp and then collect ([ref|http://help.sap.com/abapdocu_70/en/ABAPCOLLECT.htm]) the data to another table.
    Regards,
    Raymond

  • How to retrieve the values from PL/SQL table types.

    Hi Every one,
    I have the following procedure:
    DECLARE
    TYPE t1 IS TABLE OF emp%ROWTYPE
    INDEX BY BINARY_INTEGER;
    t t1;
    BEGIN
    SELECT *
    BULK COLLECT INTO t
    FROM emp;
    END;
    This procedure works perfectly fine to store the rows of employee in a table type. I am not able to retrieve the values from Pl/SQL table and display it using dbms_output.put_line command.
    Can anybody help me please!!!!!
    Thanks
    Ahmed.

    You mean, you can't add this
    for i in t.first..t.last loop
    dbms_output.put_line(t(i).empno||' '||t(i).ename||' '||t(i).job);
    end loop;or you can't add this
    set serveroutput onor maybe, you are working in third party application where dbms_output is not applicable at all?
    You see, not able like very similar it is not working - both are too vague...
    Best regards
    Maxim

  • How can I just display the selected value of a listbox in a report without the reverse display and selection buttons?

    I am using a table which contains a text field with a lookup. I want to use the selected value of this field in a form which is acting as a selection form. No editing of the field's value is permitted. How do I just display the value of the field (which
    is considered a listbox on the form) without the reverse display and the up and down selection buttons. 
    I can provide an illustration of the condition I am trying to overcome, but this system doesn't accept it.
    Thank you for any suggestions or clarification you can provide.
    Marj Weir

    Thank you.  I'll try that approach. 
    I found, after much experimentation, on a similar problem involving a multiselect lookup field,  that if I make the field invisible, and add a  textbox that displays the fieldname plus .column(0), it displays all the selected entries. 
    E.g.: staff.Column(0)
    Staff is the field containing the last names of selected staff members. 
    staff.Value only shows the first name in the lookup list whether it is checked or not, so this is useless.
    staff.column(0), however, (inexplicably) shows all the selected names, e.g. Jones, Smith, Wiggins.
    Marj Weir
     

Maybe you are looking for

  • Windows 7 64 Bit, Intel Core i7, Photoshop CS4

    I just had a new computer built with Windows 7 64 Bit, Intel Core i7 and an nVidia GT240 Card....I am unable to view my "Libraries" in the Bridge...I only get "no files to view".  If nothing else my Documents, Pictures and Music should be showing.  I

  • How to delete the records with routine Z_AFRP4_DELETE as note [418584|

    Hello Gurus, I don't want to transfer data into HR and want to delete the records in table AFRP4 to business complete the Maintenance Orders Component version- EHP7 for SAP ERP 6.0 Component-EA-APPL Release-617 how can I delete these records Thanks f

  • Ralink 2860 Wireless Card

    Hello, with my Ralink 2860 my wireless device has always been identified as ra0 instead of wlan0 and it worked fine. Well with a recent kernel update, my device got switched to being identified as wlan0, and now I have problems connecting to networks

  • Translation problem - using browser language

    Hi, I have an application with french as the primary language and english as the secondary. To switch between both, i'm using an application item. When i'm on the application in french (application item set to french) the login page shows correctly u

  • Linq to sql return dynamic table

    Hi, I am looking to use linq to sql like I did with ADO and return a dynamic table like I did with a datatable. I will not know what table/fields will return until runtime.  I later want to loop through the return table and get the field names and va