How to output in HTML form?

Hi everyone,
I'm trying to run my java application from command line and I want my output in a html form. Does j2sdk1.4.0 support this or do I have to install anything else? And how do I put the code in System.out.print().
Please help
Cheers

HTML is just text, and you can output text, so yes. Something likeSystem.out.println("<html>");
System.out.println("<head><title>Not very useful</title></head>");
System.out.println("<body>");
// and so onWas that what you meant?

Similar Messages

  • In portlets, how to use a html form passing  values to the another page?

    it is well known that in web developing , we have two methods to pass values to another page.<!--
    1. passing values
    2.<form action="nextPage" method ="post"></form>-->
    but how to use two methods in oracle portal portlets?
    I have got a simple example which submit two values to the page for itself, means a page has a form with submit botton, user input the form with values and then submit them by submit botton, then the page recevice those values and show it .
    this example is powered by oracle ,
    please have a look at these code:
    <br><br>
    <%@ page contentType="text/html;charset=UTF-8" %>
    <%@page import="java.util.*, oracle.portal.provider.v2.*" %>
    <%@page import="oracle.portal.provider.v2.http.HttpCommonConstants" %>
    <%@page import="oracle.portal.provider.v2.render.PortletRendererUtil" %>
    <%@page import="oracle.portal.provider.v2.render.PortletRenderRequest" %>
    <%@page import="oracle.portal.provider.v2.render.http.HttpPortletRendererUtil" %>
    <%@page import="oracle.portal.provider.v2.url.UrlUtils" %>
    <%
    // The form submit URL refers to the current Portal page. All portlets
    // on this page share this URL. This means that the per portlet parameters
    // are in the same request. Portlets must ensure that its paramerters don't
    // collide either with other portlets or other instances of itself. This
    // is generally accomplished by using "fully-qualified" parameter names. A
    // fully-qualified parameter name prepends the (unique) portlet reference to
    // the parameter. The JPDK provides a utility to accomplish this.
    String portletParamName = "mName";
    String portletParamAge = "mAge";
    String portletParamSubmit = "mSubmit";
    String fName = HttpPortletRendererUtil.portletParameter(request, portletParamName);
    String fAge = HttpPortletRendererUtil.portletParameter(request, portletParamAge);
    String fSubmit = HttpPortletRendererUtil.portletParameter(request, portletParamSubmit);
    // These are the session attribute names used to store the current values.
    // Because all instances of this portlet share the same user session we must
    // also fully-qualify these names to avoid collisions.
    String sName = HttpPortletRendererUtil.portletParameter(request, "sName");
    String sAge = HttpPortletRendererUtil.portletParameter(request, "sAge");
    PortletRenderRequest pRequest = (PortletRenderRequest)
    request.getAttribute(HttpCommonConstants.PORTLET_RENDER_REQUEST);
    String formName = UrlUtils.htmlFormName(pRequest,null);
    ProviderUser user = pRequest.getUser();
    ProviderSession providerSession = user.getSession();
    if (providerSession == null)
    %>
    Your provider session has been terminated or has timed out
    and you need to logout and then login to re-establish the session.
    <%
    else
    // Record, in session storage, the last values submitted.
    if (pRequest.getQualifiedParameter(portletParamSubmit) != null)
    providerSession.setAttribute(sName, pRequest.getQualifiedParameter(portletParamName));
    providerSession.setAttribute(sAge, pRequest.getQualifiedParameter(portletParamAge));
    %>
    <!-- Output the HTML content -->
    <center>
    <table width="70%">
    <tr>
    <td>
    <b>This portlet shows how to post and process information from HTML forms.</b>
    </td>
    </tr>
    </table>
    <form name="<%= formName %>" method="POST"
    action="<%= UrlUtils.htmlFormActionLink(pRequest,UrlUtils.PAGE_LINK) %>">
    <%= UrlUtils.htmlFormHiddenFields(pRequest,UrlUtils.PAGE_LINK, formName) %>
    <table>
    <tr>
    <td>
    <b>Name :</b>
    </td>
    <td>
    <input type="text" size="20" name="<%= fName %>" value="">
    </td>
    </tr>
    <tr>
    <td>
    <b>Age : </b>
    </td>
    <td>
    <input type="text" size="3" name="<%= fAge %>" value="">
    </td>
    </tr>
    </table>
    <br>
    <INPUT TYPE=submit name="<%= fSubmit %>" Value="Submit">
    </form>
    <%
    if ((providerSession.getAttribute(sName) == null)&& (providerSession.getAttribute(sAge) == null)) {
    %>
    <b>No values have been submitted yet.</b>
    <%
    } else {
    %>
    <b> Last submitted values:</b><br>
    <table>
    <tr>
    <td>
    <b>Name: </b>
    </td>
    <td>
    <b><%= providerSession.getAttribute(sName) %></b>
    </td>
    </tr>
    <tr>
    <td>
    <b>Age: </b>
    </td>
    <td>
    <b><%= providerSession.getAttribute(sAge) %></b>
    </td>
    </tr>
    </table>
    <%
    %>
    </center>
    <%
    %>
    <br><br>
    <br><br>
    <br><br>
    but I want to write the form in a page , and then show it on another page , how to write it ?
    I have read the pdk:
    oracle.portal.provider.v2.url Classes
    UrlUtils
    then I use these method , as this :
    //frist page:
    <br><br><br><br>
    <%@page contentType="text/html; charset=Big5"
    import="oracle.portal.provider.v2.render.PortletRenderRequest"
    import="oracle.portal.provider.v2.http.HttpCommonConstants"
    %>
    <%@ page import="oracle.portal.provider.v2.*"%>
    <%@ page import="oracle.portal.provider.v2.render.PortletRendererUtil"%>
    <%@ page import="oracle.portal.provider.v2.render.http.HttpPortletRendererUtil"%>
    <%@ page import="oracle.portal.provider.v2.url.UrlUtils"%>
    <%
    PortletRenderRequest pReq = (PortletRenderRequest)
    request.getAttribute(HttpCommonConstants.PORTLET_RENDER_REQUEST);
    %>
    <P>Hello <%= pReq.getUser().getName() %>.</P>
    <P>This is the <b><i>Show</i></b> render mode!</P>
    this is a program to test the passing value
    <%
    String portletParamName = "mName";
    String portletParamAge = "mAge";
    String portletParamSubmit = "mSubmit";
    String fName = HttpPortletRendererUtil.portletParameter(request, portletParamName);
    String fAge = HttpPortletRendererUtil.portletParameter(request, portletParamAge);
    String fSubmit = HttpPortletRendererUtil.portletParameter(request, portletParamSubmit);
    PortletRenderRequest pr=(PortletRenderRequest)request.getAttribute(HttpCommonConstants.PORTLET_RENDER_REQUEST);
    String formName=UrlUtils.htmlFormName(pr, null);
    %>
    <form name="<%=formName%>" method="post" action="<%=UrlUtils.htmlFormActionLink("/htdocs/passingvalues4/getValues.jsp")%>">
    <%= UrlUtils.htmlFormHiddenFields("/htdocs/passingvalues4/getValues.jsp") %>
    name:<input type="text" size="20" name="<%= fName %>" value="">
    p w :<input type="text" size="3" name="<%= fAge %>" value="">
    <INPUT TYPE=submit name="<%= fSubmit %>" Value="Submit">
    </form>
    //getValues.jsp<br><br>
    <br><br>
    <%@page contentType="text/html; charset=Big5"
    import="oracle.portal.provider.v2.render.PortletRenderRequest"
    import="oracle.portal.provider.v2.http.HttpCommonConstants"
    %>
    <%@ page import="oracle.portal.provider.v2.*"%>
    <%@ page import="oracle.portal.provider.v2.render.PortletRendererUtil"%>
    <%@ page import="oracle.portal.provider.v2.render.http.HttpPortletRendererUtil"%>
    <%@ page import="oracle.portal.provider.v2.url.UrlUtils"%>
    <% String portletParamName = "mName";
    String portletParamAge = "mAge";
    String portletParamSubmit = "mSubmit";
    String fName = HttpPortletRendererUtil.portletParameter(request, portletParamName);
    String fAge = HttpPortletRendererUtil.portletParameter(request, portletParamAge);
    String fSubmit = HttpPortletRendererUtil.portletParameter(request, portletParamSubmit);%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Big5">
    <title>untitled</title>
    </head>
    <body>
    Name:<%=fName%>
    Age :<%=fAge%>
    </body>
    </html>
    <br>then I deployed them on the portal , run it , the result is :after I submit it , the browser give me : http 404 page not found!
    [b]here is the provider.xml<br>[b[i]]<?xml version = '1.0' encoding = 'UTF-8'?>
    <?providerDefinition version="3.1"?>
    <provider class="oracle.portal.provider.v2.DefaultProviderDefinition">
    <session>true</session>
    <passAllUrlParams>true</passAllUrlParams>
    <portlet class="oracle.portal.provider.v2.DefaultPortletDefinition">
    <id>1</id>
    <name>PassingValues4</name>
    <title>PassingValues4</title>
    <description>PassingValues4</description>
    <timeout>60</timeout>
    <showEditToPublic>false</showEditToPublic>
    <hasAbout>false</hasAbout>
    <showEdit>false</showEdit>
    <hasHelp>false</hasHelp>
    <showEditDefault>false</showEditDefault>
    <showDetails>false</showDetails>
    <renderer class="oracle.portal.provider.v2.render.RenderManager">
    <renderContainer>true</renderContainer>
    <renderCustomize>true</renderCustomize>
    <autoRedirect>true</autoRedirect>
    <contentType>text/html</contentType>
    <showPage>/htdocs/passingvalues4/PassingValues4InputPage.jsp</showPage>
    <showPage>/htdocs/passingvalues4/getValues.jsp</showPage>
    </renderer>
    </portlet>
    </provider>
    <br><br><br>
    <br><br>
    would you kind enough to help me ? thanks!!!
    Message was edited by:
    moonsoft

    Hi Moonsoft,
    I have already answered this query in the other post at Re: how to link more than one links in portlet?(jsp develop)
    <form name = "showPageForm" method = "POST" action = "<%= UrlUtils.htmlFormActionLink(pReq,UrlUtils.PAGE_LINK) %>">
      <%= UrlUtils.htmlFormHiddenFields(pReq,UrlUtils.PAGE_LINK, "showPageForm") %>
      <input type="text" name="param1">
      <input type="text" name="param2">
      <input type="hidden" name="myPPN" value="/htdocs/page2.jsp">
    </form>then in your jsp code on page2.jsp, you will extract the parameters by specifying
    <%
      String p1 = request.getParameter("param1");
      String p2 = request.getParameter("param2");
    %>
    >>this is easy common jsp or asp development, but in oracle is too diffcult!!!!
    :-) .. there is a difference between web-applications and portlets, you just need to get used to it once. I hope this does clarify your doubts.
    thanks,
    Harsha

  • How to use an html form to search my database??

    Hey guys,
    I'm going through 100's of tutorials on creating a PHP CMS structure for my website and did manage to build a very simple 1. I have 1 question that i need your help with. I was browsing through websites on Google and discovered this website that you can search their data base with a an html form. How can I achieve this in the most simplest ways.
    Site URL: http://www.istructe.org/yearbook/index.asp
    Yours
    Ashveer

    The form's data is submitted to a php script.  The script harvests the data and formulates a SQL select statement -
    SELECT * FROM TABLE WHERE fieldname1 = fieldvalue1 AND fieldname2 = fieldvalue2....
    (the form's fields are used to build the WHERE part of the statement)
    After executing the search the script looks at the number of records found.  If that is zero, there were no matches.  If there is 1 or more records found, each is printed to the page.  You would need some facility with a server scripting language to do this, although not too much.  It's fairly simple.

  • How to make embedded HTML form look normal?

    Hello,
    In Muse, if I Insert HTML code with:
    <form action="action_page.php">
    First name:<br>
    <input type="text" name="firstname" value="Mickey">
    <br>
    Last name:<br>
    <input type="text" name="lastname" value="Mouse">
    <br><br>
    <input type="submit" value="Submit">
    </form>
    …the form is displayed in my Muse page.  However, it doesn't look normal, meaning:
    - The text fields have no border and appear to be invisible until you start typing in them.
    - The Submit button size is minimal, wrapping tightly around the text, and there is no border or bevel.
    * I have experimented with specifying an HTML border and width in the above code, with no change in results.
    Basically, this HTML code looks normal in a regular .html page.  However, in a Muse page (with Insert HTML), the visual appearance of the form elements looks abnormal… stripped-down.
    Can anyone suggest a way to add HTML form content and make it look correct?  I don't want to use the Muse Form Widgets, because they all "require" the email field, and I don't want that capability.  Thanks for any suggestions.

    I answered my own problem.
    It seems that the solution is having knowledge of CSS, which I don't.  That's what Muse is supposed to provide, and I'm not a CSS expert.
    At http://www.ronpershing.com/blog/how-to-make-a-custom-contact-form-in-adobe-muse/ , Ron Pershing gives some very simple code on making it all work with Muse.  I'm not affiliated with him or his website, but since he was kind enough to publish a solution, his work should get some attention.

  • How to make custom html form buttons - here's a way to do it.

    I have been trying to create custom HTML form rollover submit/Reset buttons but could not get it going.
    There is a Javascript way but I do not know how.
    Anyway, I manage to get it working in all browsers except for IE 6. It does not hover in IE 6.
    Here is the HTML code:
    <label class="contact_form_btn">
    <input type="submit" name="submit_btn" class="contact_form_submit_btn" value="Submit form" />
    </label>
    And here is the CSS:
    .contact_form_btn, .contact_form_submit_btn {
        margin: 0;
        padding: 0;
        display: block;
        line-height: 40px;
        height: 40px;
        width: 200px;
        font-family: "Century Gothic", "Trebuchet MS", Verdana, Tahoma;
        font-size: 20px;
        color: #FFFFFF;
        font-weight: bold;
        float: left;
        background-image: url(../my_website_images/form_btn_set.jpg);
        background-repeat: repeat-x;
        background-position: bottom;
    .contact_form_btn {
        background-image: url(../my_website_images/form_btn_set.jpg);
        background-repeat: repeat-x;
        background-position: bottom;
    .contact_form_submit_btn {
        background: transparent;
        border: none;
        cursor: pointer;
        float: left;
        clear: left;
    .contact_form_btn:hover {
        background-image: url(../my_website_images/form_btn_set.jpg);
        background-repeat: repeat-x;
        background-position: top;
    It works perfectly but not in IE 6.
    In IE 6 the image does work but there is no hover effect.
    I'm using it anyway - screw it.
    But for the sake of learning and advancement  - does anybody have an idea why it will not rollover in IE 6?

    JoeyD1978 wrote:
    You can use an HTC to fix the hover on IE6:
    http://www.danvega.org/blog/index.cfm/2008/1/1/CSS-hover-selector
    Hello,
    I read the information on the link you posted but I'm a litle confused as to how this is implemented.
    There is nothing mentioned about attaching a script to the document.
    All I read is that you add this to the body:  body {    behavior: url("csshover3.htc"); }
    And so my question is. The files that you download, where do you put them? Do you attached them to the header of the html page?
    Or do you pull them through the url that's attached in the CSS page body?
    I have contacted the author but if you know the answer, please explain further.
    Thanks again, Patrick

  • How to submit a html form using java

    hi friends,
    i have a html form with some input fields, when ever a user submit the form the user information is stored in the database. is it possible to pass the user information in the url(url rewriting) and submit it by a java program so that the data will be stored in the database, as like as, user submit it manually.
    for eg:
    /*sample.html*/
    <form action="store.jsp" method="post">
    User Data:<input type="text" name="userdata">
    <input type="submit">
    </form>
    in my java is it possible to store the record as below:
    URL url=new URL("http://localhost:7001/webapp/store.jsp?userdata=AutomaticDatasave");
    URLConnection con=url.openConnection();
    int i=0;
    while((i=con.getInputStream().read())!=-1)
    System.out.print(i);/*it has to print the data that store.jsp is returned like information stored or error storing data(what ever)*/
    }Edited by: rajaram on Oct 27, 2007 1:01 AM

    hi Drclap,
    Thanks for your reply, which is helpful to me....
    tried what you said, what i did is modified the code like below
    con.setDoOutput(true);
    BufferedWriter br=new BufferedWriter(new InputStreamWriter(con.getOutputStream()));
    String str="userdata=AutomateDataSave\n";
    br.write(str,0,str.length());
    br.flush()But
    Iam Getting Internal Server Error
    Exception in thread "main" java.io.IOException: Server returned HTTP response code: 500 for URL
    Edited by: rajaram on Oct 27, 2007 1:24 AM

  • Reports 6i -- How to create an HTML form template before form processing

    Hello Oracle Reports Gurus,
    I'm using Oracle Reports 6i and trying to create an HTML form WITHOUT using the Oracle Reports 6i parameter form builder. The goal: to take a web page already in existence containing a form with checkboxes and radio buttons and make it 'transparent' to my users in hooking it to Oracle Reports. So far, I made my HTML page (with form and all) a "header" file for my Oracle report and didn't place anything in the parameter form builder. However, upon doing so, Reports 6i decided to be extra helpful and place form elements into the Parameter form builder.
    So,
    1) Is there a way to take a web page with a form and all and easily "plug it" into Oracle Reports 6i WITHOUT using the Parameter Form builder?
    2) Is there another way to create an HTML form that will allow me to have radio buttons, checkboxes, etc?
    Thanks in advance from this Oracle Reports newbie,
    Lee Lonitz
    Webmaster
    Lockheed Martin IS&S
    [email protected]

    lee,
    i am not exactly sure what you are trying to do. since you state you use HTML, i assume you are running 3-tier with the report server, right ?
    if so, the easiest way to hook your parameter form up to your report is to just pass the URL to the report as the action URL for your form.
    in 9i/10g we provide the Reports Web source, which is based on JSP and allows you to paste HTML into your report to create a highly customized HTML parameter form.
    i am afraid in 6i, we don't provide a way to actually combine your HTML form ito the report. it needs to stay separate, but can link to the report using the way i described above.
    thanks,
    ph.

  • How to convert an HTML form to PDF

    Is there any way to convert HTML page (with text boxes,radio/submit buttons) into a PDF file so form can be entered in a PDF format??

    DanCrintea wrote:
    HTML to PDF with Java, using OpenOffice.org - example here: [http://www.dancrintea.ro/html-to-pdf/|http://www.dancrintea.ro/html-to-pdf/]
    You can use OpenOffice.org, running as a server and command it remotely for document convertion.
    Besides HTML to PDF, there are also possible other convertions:
    doc --> pdf, html, txt, rtf
    xls --> pdf, html, csv
    ppt --> pdf, swf
    Code example:
    import officetools.OfficeFile; // this is my tools package
    FileInputStream fis = new FileInputStream(new File("c:/test.html"));
    FileOutputStream fos = new FileOutputStream(new File("c:/test.pdf"));
    // suppose OpenOffice.org runs on localhost, port 8100
    OfficeFile f = new OfficeFile(fis,"localhost","8100", true);
    f.convert(fos,"pdf");
    -----------------------------------------------------------------------------------------------------------------------------------------You really think this is a good way to market your crappy product?

  • How do I disable html form login credentials from caching/saving?

    I have included multiple modifications to the user.js file (SLES11, firefox-3.6.16-0.2.1) to acheive most of my requirements, but I cannot find the about:config setting that prevents usernames (and passwords depending on the setting chosen) from saving.
    I have been using about:config to confirm the setting in pref.js then I change the setting back to the default in about:config, and add the appropriate config line to user.js rather than have it set in pref.js
    The information I found online directs me to Edit --> Preferences, but this configuration needs to be written for use in a base image to be distributed.

    You're welcome.
    The pref signon.prefillForms was used in Firefox 2.<br />
    Firefox 3+ uses signon.autofillForms
    * http://kb.mozillazine.org/signon.autofillForms
    * http://kb.mozillazine.org/signon.prefillForms
    Firefox 4+ also has security.password_lifetime for the master password.

  • How can I change the order of html form data submitted to me via email?

    I am having customers contact me via an html form posted on my website using the "sendtoemail" command. When I receive the data in an e-mail it  is not presented in the order it appears on the web page and I can't seem to find out what dictates the order the data is presented in or how I can change it.
    Anyone have any ideas on how I can make HTML form data elements appear in the order I want?
    Thanks,
    Andy

    Or find a commercial form-to-email script that is compatible with your server's configuration (PHP, ASP, Perl...) and customize it to your needs.
    Formm@ailer PHP from DB Masters
    http://dbmasters.net/index.php?id=4
    FormToEmail.com (free & pro versions available)
    http://formtoemail.com/formtoemail_pro_version.php    
    Tectite
    http://www.tectite.com/formmailpage.php
    Forms to Go from Bebosoft (script generating software)
    http://www.bebosoft.com/products/formstogo/overview/
    Nancy O.

  • Html Form

    Hellow to everybody, i got this problem.
    I will like to know, how to create an html form, to put on a
    unix server
    that dosent suport
    cgis, or asp.
    Is a simple html form, the one includes: name, phone, email
    and coments,
    and two butons, one for clear an the other for sent.
    Thanks to anyone, who can help me.
    David

    Does it support PHP? If so:
    http://www.avenuedesigners.com/blog/articles.php?ref=30
    If not, what type of SSS (server-side scripting is available
    to you)? If
    none, you're then stuck using the infamous "mailto," which
    isn't good:
    http://www.apptools.com/rants/mailto.php
    That, or using a third-party company to handle your forms.
    Let us know.
    Shane H
    [email protected]
    http://www.avenuedesigners.com
    =============================================
    Proud GAWDS Member
    http://www.gawds.org/showmember.php?memberid=1495
    Delivering accessible websites to all ...
    =============================================
    "david pc" <[email protected]> wrote in message
    news:e93c30$fee$[email protected]..
    > Hellow to everybody, i got this problem.
    >
    > I will like to know, how to create an html form, to put
    on a unix server
    > that dosent suport
    > cgis, or asp.
    >
    > Is a simple html form, the one includes: name, phone,
    email and coments,
    > and two butons, one for clear an the other for sent.
    >
    > Thanks to anyone, who can help me.
    > David
    >
    >
    >

  • Reading html data & uploading a file in single html form using htp package

    Hi
    I have designed a html screen using htp package in which i have few text items and file upload button. I have to validate all forms data like text items and check box elements and upload file to unix. I am using java script for file validations and cgi script to upload file. With this I am able to either read form data or upload file but not both.
    At a time I want to insert a record to database with html form values and upload file to unix with htp package. Please suggest how can I read html form data + uploading a file to unix simultaneously in a single htp procedure.
    Thanks,
    Pradeep

    Have you ever considered using Application Express (APEX)?
    Oracle Application Express (APEX)
    Sounds like you're going the long way around to create a web based application.

  • HTML forms Expert advice needed

    How do I enable html forms to save and remember input data,
    even if the browser is closed or if the user mover forward or
    backwards through pages

    Put the data into a database when the form is submitted - or
    is that not
    what you are asking?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "mrharvey987" <[email protected]> wrote in
    message
    news:eks1d4$448$[email protected]..
    > How do I enable html forms to save and remember input
    data, even if the
    > browser is closed or if the user mover forward or
    backwards through pages

  • How to return a html repsonse after form guide rendering in browser?

    How to return a html repsonse after form guide rendering in browser indicating that server has recieved transmission and request is submitted succesfuly?
    I am rendering the form guide in browser using guide invoke service and when i submit the data in browser to server through guide , it is displaying some random number in browser?
    i need to display a resposne that request is submitted successfully?

    how could i define a variable with "html data" ?
    Create a variable of type document and then a service to read the html from where ever it's located. If you put it in LiveCycle, you can use the ReadRessource service. If it's on the file system, you can use the Read Document. If it's in the database, you can use the JDBC service.
    Also, one more doubt where should i use this variable in my process to get the same?
    You want the response once you've submitted the data, so the html is really the result of calling the process that's processing the data. So I would create an output variable of type document on that process.
    Right now it displays a random number in the browser because your submit process is long lived. When a process is long lived (asynchronous), you invoke it and then you get an identifier back. It's kind of a fire and forget. You can use that identifier to check the status of the long lived process, since long lived processes can take hours, days to complete. You don't want your browser to wait that long, hence the identifier.
    However if you change the process to be short lived (synchronous), the browser will wait for the result of the process, which really means the output variables for that process. If your output variable contains html, it'll display html.
    So the key is make you submit process short lived and populate the output variables appropriately.
    Jasmin

  • 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();
    }

Maybe you are looking for