Can i display HTML

Can i make this code display HTML, and how?
Examples and comments please. i need help
Simpletext Java Applet.
Applet displays a text file from the web in a text area.
The Text Area is as large as the APPLET Width and Height commands.
There is no animation
It loads quickly
And provides information that can be provided quickly.
Utilizes the following Params
<PARAM NAME = "filename" Value = "URL">
<PARAM NAME = "fontname" Value = "Fontname">
<PARAM NAME = "fontsize" Value = "Fontsize">
This is very useful for placing on a page where you want to have information
added without having to touch the HTML in the page.  It can also be placed into
a table.
import java.awt.*;
import java.io.DataInputStream;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.net.MalformedURLException;
public class simpletext extends java.applet.Applet implements Runnable
  URL theURL;
  Thread runner;
  TextArea ta = new TextArea("Getting text...",7,70);
  public void init() {
    String fname = getParameter("fontname");
    String fsize = getParameter("fontsize");
    int fs = Integer.parseInt(fsize);
    Font tafont = new Font(fname,Font.PLAIN,fs);
    String url = getParameter("filename");
    try { this.theURL = new URL(url); }
    catch ( MalformedURLException e) {
      System.out.println("Bad URL: " + theURL);
  ta.setEditable(false);
  ta.setFont(tafont);
  setLayout(new BorderLayout());
    add("Center",ta);
//    string fnts = getFontList();//not yet implemented in Toolkit
  public void start() {
    if (runner == null) {
      runner = new Thread(this);
      runner.start();
  public void stop() {
    if (runner != null) {
      runner.stop();
      runner = null;
  public void run() {
    URLConnection conn = null;
    DataInputStream data = null;
    String line;
    StringBuffer buf = new StringBuffer();
    try {
      conn = this.theURL.openConnection();
      conn.connect();
      ta.setText("Connection opened...");
      data = new DataInputStream(new BufferedInputStream(
               conn.getInputStream()));
      ta.setText("Reading data...");
      while ((line = data.readLine()) != null) {
          buf.append(line + " HERE\n");
     ta.setText(buf.toString());
    catch (IOException e) {
      System.out.println("IO Error:" + e.getMessage());
}

Well now we are getting somewhere.
Yes your right it is a copy and paste job, i needed
somewhere to start and found that and thought it was
good.
I have been coding PHP/MySQL/HTML for years now so i
think i am ready to learn java.
PHP! Ick!
i have been following the tutorials at:
http://java.sun.com/docs/books/tutorial/getStarted/cup
ojava/index.html
and iv read up to:
http://java.sun.com/docs/books/tutorial/java/data/garb
agecollection.html
Well that's a good start.
The point of my applicvation:
To display realtime quotes (stock prices). or atleast
with 30 second updates.Ah-ha!
here is my PHP version:
http://www.fxdon.com/pgs/main_indices_frame.php
(which updates every 30 seconds)more Ah-ha!
>
and what i ment about security, is i didnt want to
"Hard-Code" SQL database details into this incase
someone somehow can decompile it.?This is a good reason. Also because then you don't have to open up the database to socket connections from anyone on the net.
I just thought it would be easier to have unix cron
update the database automatically and use php page to
fetch the updates and java to display it.
Also i cant make php page refresh automatically like
u can with java, i have to use some meta refresh
tags.Okay.
>
Am i on the wrong track?Yes.
What you need to do is basically implement a simple webservice. (This seems to be a popular topic today.)
The idea is that the data comes from your site through HTTP but it is not really a web page. It is some sort of data page.
Before I go further I am going to suggest something rather simple. A better model might use a webservice standard of some sort and return the data in an XML doc for example. You can read more about webservices in Java here http://java.sun.com/webservices/index.jsp
Now here is my example.
On the server have a php script like this.
<?php
/*I am assuming an open mysql connection here. Also that your GET
request variables are being parsed and are available for use*/
header("Content-type: text/plain");
if(!$sym){
  echo "FAIL\nNO SYMBOL\n";
}else{
  $rs = mysql_query("SELECT company,lastrade FROM stockprice WHERE symbol=".$sym);
  if($row = mysql_fetch_row($rs)){
    echo "OK\n";   
    echo $row[0]."\t";
    echo $row[1]."\t";
    echo "\n";
  }else{
    echo "FAIL\nUNKNOWN SYMBOL\n";
?>Then when you want to get the data from the applet you put in the url like this..
www.mysite.com/mystockpriceservice.php?sym=AAA
And the content returned will be a text file.
The first line will say OK if everything worked or FAIL if it didn't. If it fails then the second line tells you why.
If it does work then the second line will be a tab delimited string of all the values.
Then you can do as you want in the applet to display that data. As a ticker or whatever.
Do you see where I am going with this?
Like I said this implementation is rather simplistic but the basic idea is there.

Similar Messages

  • Can I display html pages in flash player

    Hi all,
    Can I display html pages in flash player, i mean swf. Plz
    help me if it can be done. Can I call html pages in flash (i mean
    in flash player no new window)
    Thanks

    hi,
    Actullay i want the site to be opened with in the flash
    player, just like iframe in dreamweaver calling the external site
    in the mail html page. Plz Help me accessing external site page
    with in flash player
    Thanks

  • How can i display HTML text in a TextArea

    Hello All,
    We are developing a chat application using Java Swing and RMI with MySQL as backend.
    We have two options.The users can chat thro both browser and application(Swing GUI).
    Now when a user who chats thro a browser sends a message,the chat contents are stored in HTML format in the database (like <BR><font>R u There?</Font></BR>).When the other user happens to chat thro the application,the chat contents send by the other user has to appear in the HTML format in the TextArea of the application.So obviously the textarea shud understand the HTML and display it accordingly.
    How can i do this?Kindly give me an example with some code samples if i have to use EditorPane etc 'coz i haven't got any experience using EditorPanes.
    Thanks in advance
    Regards
    Vijayakannan

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Test extends JFrame {
        public Test() {
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         Container content = getContentPane();
         JEditorPane jep = new JEditorPane("text/html",
                  "Joe: <font color=red>R u <b>There</b>?</Font><BR>"+
                  "Mary: <font color=green>Keep ur shorts on...</Font>");
         content.add(new JScrollPane(jep), BorderLayout.CENTER);
         setSize(200,200);
         show();
        public static void main(String[] args) { new Test(); }
    }

  • MIME-TYPE is stored incorrectly sometimes, browsers can't display html content

    Our company is switching from Netscape Communicator to Internet Explorer 5.5 . This resulted sometimes in html-documents which could not be opened in netscape anymore, but caused the save-as dialogue box to pop-up.
    Analysis of this problem, with the aid of Oracle Support, showed some html-documents were stored in WWV_DOCUMENT with mime-type application/octer-stream. This is a mime type which should trigger the save-as pop-up dialogue in browsers. Netscape acts accordingly, but IE does display the content normally.
    The following events cause this problem:
    1. create a html document using a microsoft office product (word/excel)
    2. DON'T close the document in the office application
    3. Use the portal wizard to upload the file to a content area
    4. Use table WWV_THINGS and WWV_DOCUMENT and see mime-type isn't text/html but application/octet-stream
    5. IE shows the file, NN wants to save it.
    The workaround to this problem is to close the file in MSOffice before uploading it.
    Oracle Development confirmed it's the browser which sends this incorrect mime-type, and portal just stores this type. It seems this mime-type is overruling the extension to mime-type mapping in the configuration of Apache, using AddType or the file mime.types.
    So the mime-types defined in apache are only used outside mod_plsql, that is, when files from the filesystem of the webserver itself are used.
    When uploading a zip-file, and unzipping it in the database, all files get the right mime-type. It seems in this situation the mime-type is determined by looking either at the file-extention or the magic bits.
    Oracle says it's a microsoft bug, so I'll have to ask Bill for a fix.
    They are probably right, and I think I could reproduce this using CGI-scripting without modplsql and portal.
    But:
    It seems not logically to me that it depends on the method of uploading files (single files, or zipped files) which method of mime-type determination is used.
    Furthermore, I find it strange that it depends on the storage location of the file (database or filesystem) which mime-type is presented at the user.
    I'd like to hear your opinions about this
    Regards,
    Ton Haver

    You want to be using <html:link forward="YOUR_FORWARD"> only when you want to forward to static elements and not elements that require actions. So in index.jsp, since you just want to forward to a static jsp page (allarticle.jsp), you can use
    <html:link forward="show">Show All forum</html:link>But since you want your "one forum" link to populate a session attribute BEFORE loading /jsp/loveforum.jsp, you need
    <html:link action="article">one forum</html:link>The reason it's not working now is because you're accessing a session attribute that isn't populated becuase you link to the page statically and it never gets the value of "list" actually stored in the session.
    The reason it works when you change your forward element is because it calls the action that saves "list" into your session.

  • How to display HTML response file in user's browser following submission of Livecycle form

    I have a PDF form created via Livecycle that does a HTTP submit to the webserver. The server returns a HTML 'submission receipt' page which is either opened in Acrobat or the user's web browser.
    Previously this process worked fine when submitting from adobe reader - the html receipt file would always automatically open OK in the user's browser. However, with newer versions of Reader (11.0.0+) I now get this error and no attempt to open the user's web browser:
    An error occurred during the submit process. Cannot process content of type text/html
    I realise why I get the error - Adobe reader can't display HTML files.
    What I don't understand is why it doesn't open the html file in the user's browser like it has been doing for years.
    Does anyone have any idea how I can fix this (without changing the response content type to PDF/FDF)?

    I had the same issue as you and we used FDF status, then eventually went with returning an XDP  that filled out a receipt section of the form.

  • How to display HTML formatted text in the field with Item Style: Raw Text

    How can I display HTML formatted text in the field with Item Style: Raw Text.
    Currently the Item Style is Raw Text, but the text is being displayed along with HTML tags without formatting.
    Regards

    Hi,
    Use Item Style formattedText.
    Regards,
    Gyan

  • How to display html in SBO forms

    Dear Developers,
    I would like to know how can I display html content in a SBO form. Has anyone any experience in this theme?
    Html viewer in active x or else?
    I have a UDF with <html> code. Is it possible to showing content in B1 forms?
    Thank you in advance.
    Regards,
    Nghia

    simply add activeX WebBrowser control to yout form
    Dim oWebX As SHDocVw.WebBrowser
                oItem = balanceform.Items.Add("browser", SAPbouiCOM.BoFormItemTypes.it_ACTIVE_X)
                oItem.Left = 5
                oItem.Top = 55
                oItem.Width = 980
                oItem.Height = 495
                ' Create the new activeX control
                AcXTree = oItem.Specific
                AcXTree.ClassID = "Shell.Explorer.2"
                oWebX = AcXTree.Object
                oWebX.Navigate("about:blank")
                oWebX = Nothing
                GC.Collect()
    You may chnage the url (file) displayed there trhough oWebX.Navigate("url/file")
    Edited by: Petr Verner on May 7, 2010 7:04 AM

  • How to display html from the jar

    Hiiiiiiiii
    How I can to display html from jar file

    Check out datagriditemrenderer for the datagrid column. Sample datagriditemrenderer code below:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Text xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:mx="library://ns.adobe.com/flex/mx"
      dataChange="updateHTML()">
      <fx:Script>
        <![CDATA[
          private function updateHTML():void
            htmlText = data.streetaddress + "\n" +
              data.city + ", " + data.state + "\n" +
              "<b>Phone:</b> " + data.phone + "\n" +
              "<b>Email:</b> " + data.email + "\n";
        ]]>
      </fx:Script>
    </mx:Text>

  • How we can load external html or php file in flash?

    Hi there,
    I want to show my php's file desing in flash..
    i m getting data through database in php file and it has
    table... so I want to show that data in my flash movie...
    Please help me ..
    How can I load external html or php file in flash?
    If any other way is there then plz tell me.....
    thanx

    No.  Flash can only display html content in textfields and only supports a very limited number of html tags (look up the htmlText property of TextFields).  So to display an html/php file is not possible.

  • How can i display collection of  records in HTML Table using DWR framework

    Dear All,
    Just i start using the Direct Web Remoting framework.I am worrying to get the list of records to display html table using this concept.I did the same like.
    index.js
    var cellFuncs = [
    function(data) { return data; },
    function(data) { return data.toUpperCase(); },
    function(data) { return "<input type='button' value='Test' onclick='alert(\"Hi\");'/>";  },
    function(data) { return count++; }
    function update() {
    var name = dwr.util.getValue("demoName");
    Demo.sayHello(name, function(data) {    dwr.util.setValue("demoReply", data);   } );
    var count = 1;
    dwr.util.addRows( "tabs",[ 'Africa', 'America', 'Asia', 'Australasia', 'Europe' ], cellFuncs);
    alert("hai");
    index.jsp
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <script type='text/javascript' src='dwr/engine.js'> </script>
    <script type='text/javascript' src='dwr/util.js'> </script>
    <script type='text/javascript' src='dwr/interface/Demo.js'> </script>
    <script type="text/javascript" src='index.js'> </script>
    </head>
    <body>
    <div id="tabContents">
    <div id="demoDiv">
    <p>
    Name:
    <input type="text" id="demoName" value="Joe"/>
    <input value="Send" type="button" onclick="update()"/>
    Reply: <span id="demoReply" style="background:#eeffdd; padding-left:4px; padding-right:4px;"></span>
         <table id="tabl1">
         <tbody id="tabs">
         <tr>
         <td>name</td>
         <td>name1</td>
         <td>name2</td>
         <td>name3sdf</td>
         </tr>
         <tbody>
         </table>
    </p>
    </div>
    </div>
    </body>
    </html>
    dwr.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE dwr PUBLIC "-//GetAhead Limited//DTD Direct Web Remoting 2.0//EN" "http://getahead.org/dwr/dwr20.dtd">
    <dwr>
    <allow>
    <!-- simpletext -->
    <create creator="new" javascript="Demo">
    <param name="class" value="org.getahead.dwrdemo.simpletext.Demo"/>
    </create>
    </allow>
    </dwr>
    web.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app id="dwr">
    <display-name>DWR (Direct Web Remoting)</display-name>
    <description>A Simple Demo DWR</description>
    <servlet>
    <servlet-name>dwr-invoker</servlet-name>
    <display-name>DWR Servlet</display-name>
    <description>Direct Web Remoter Servlet</description>
    <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
    <init-param>
    <param-name>debug</param-name>
    <param-value>true</param-value>
    </init-param>
    <init-param>
    <param-name>activeReverseAjaxEnabled</param-name>
    <param-value>true</param-value>
    </init-param>
    <init-param>
    <param-name>initApplicationScopeCreatorsAtStartup</param-name>
    <param-value>true</param-value>
    </init-param>
    <init-param>
    <param-name>maxWaitAfterWrite</param-name>
    <param-value>500</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>dwr-invoker</servlet-name>
    <url-pattern>/dwr/*</url-pattern>
    </servlet-mapping>
    </web-app>
    Demo.java
    package org.getahead.dwrdemo.simpletext;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import org.directwebremoting.WebContext;
    import org.directwebremoting.WebContextFactory;
    public class Demo
    public String sayHello(String name)
    return "Hello, " + name;
    the sayHello() is printing the display.But the table rows not updating.But its object expected.So can you tell me where i need to change and how to add the pagination for the table like 10 by 10 records to display.
    Please help me.
    Saravanan

    Hi Brian,
    OAF supports the master-detail based design. You can very well implement your model. You can use 2 VO for your 2 objects and link them using a ViewLink. Check OAF Dev guide for more details.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How can I display the HTML page from servlet which is called by an applet

    How can I display the HTML page from servlet which is called by an
    applet using the doPost method. If I print the response i can able to see the html document. How I can display it in the browser.
    I am calling my struts action class from the applet. I want to show the response in the same browser.
    Code samples will be appreciated.

    hi
    I got one way for this .
    call a javascript in showDocument() to submit the form

  • How can I display Excel document saved as html in ebDynpro Office Contol?

    Hello,
    I have a problem with displaying of Excel document saved as html inside WebDynpro Office Control.
    Could you explain why OfficeControl cannot display Excel document with content type =text/htm?
    How you know, control must be bound to binary data. And then mime type is set as
    bin.setMimeType(new WebResourceType("html", "text/html", false));
    The empty document is displayed always.
    Nevertheless, excel file is displayed perfect, when
    bin.setMimeType(new WebResourceType("xls ", "application/msexcel", false));

    The OfficeControl UI element is made available as an ActiveX control, so that the UI element can be displayed in browsers that support ActiveX controls.
    The ActiveX control enables display of the following documents:
    1.Microsoft Word documents with the doc file extension
    2.Microsoft Excel documents with the xls file extension
    This is the reason why document with other content types are not displayed.
    Data source must be bound to binary data because files are read as bytes in this scenario.
    Hope this helps you.
    Do let me know if your problem is solved.
    Regards,
    Vijith

  • How can I send HTML emails that display in Mail?

    Hi,
    I have an email newsletter that I recently have begun experimenting with in HTML. The problem is, when I try to use HTML, the message displays properly in things like Yahoo! webmail, but in Mail for OSX, it displays like a regular text message, images and formatting are not used. I'm sending the messages from PHPList. Is there something I need to add to my code to get it to display correctly?
    Thanks much.
    -Jonas

    Well, I did check the layout in Safari, and it looked fine. Since I'm not sending the messages from Mail (since it's for a rather large mailing list handled by PHPList), selecting "Mail the Contents of this Page" wouldn't really do very much for me.
    If I do try to send the page using that technique, it does work. But I have to use PHPList to compose and mail the message. I just need to know if there's any other code I need to add to make it display in Mail. I can receive other HTML emails no problem, but mine just shows up as text, disregarding images and other elements. I just don't know what's going on here.

  • When I get an email with an HTML it does not show up and I get the following message: There are no parts that can be displayed inline.

    When I receive an email with and HTML included I get the following message: "There are no parts that can be displayed inline", but no document to open.
    == This happened ==
    Every time Firefox opened
    == a month ago

    I don't know. I don't have access to Iquest, and some searching on google for ''Iquest webmail "There are no parts that can be displayed inline"'' doesn't really turn up anything.
    Does Iquest have their own support?

  • JEditorPane can not display the applet contained in a html

    We know that class JEditorPane can be used to display Html pages. but it has limitation. When a Html page contains Applet, it can not display the applet! Does anyone know if there's any solution for this problem?

    Hi, i do the 'CREATE_TEXT', after the PO created,   the PO created correctly except the Long Text.
    THE CODE:
    *********************1*********************
        CALL FUNCTION 'BAPI_PRODORD_CREATE'
          EXPORTING
            orderdata    = wa_po
          IMPORTING
            return       = rt
            order_number = aufnr
            order_type   = otype.
    Then i got a AUFNR,
    **********************2**********************
    CONCATENATE sy-mandt aufnr INTO t_name.
          CALL FUNCTION 'CREATE_TEXT'
            EXPORTING
              fid         = 'KOPF'
              flanguage   = 'E'
              fname       = t_name
              fobject     = 'AUFK'
              save_direct = 'X'
              fformat     = '*'
            TABLES
              flines      = it_text
            EXCEPTIONS
              no_init     = 1
              no_save     = 2
              OTHERS      = 3.
    and SY-SUBRC is 0.
    the long text also generated, but can not displayed on the CO03

Maybe you are looking for

  • Have you received "Exception processing Message" when opening iTunes?

    When I attempt to open iTunes my computer gives me the following message "Exception processing message c0000013 Parameters 75b6bf9c 4 75b6bf9c 75b6bf9c" In top left corner of the window it says Windows no disk. I have uninstalled iTunes and reinstall

  • Java.lang.NullPointerException when connecting to DB

    Running what I think is the latest version of Oracle SQL Developer, 2.1.0.63.73 on JDK 1.6.0_17, Windows XP. Every 2nd or 3rd time I run SQL Dev, I get the following when I go to connect: Error Connecting, with the below in the "Details" java.lang.Nu

  • Firefox freezes webpage & same in private browsing too ????? help

    One webpage when advanced to the next page freezes Firefox (not responding) in exiting session. Tried deleting cookies & history, safe mode, Chrome & private browsing in Firefox to no avail. The only one that works is IE inprivate browsing. What else

  • HT2204 how can I end an automatic renewal app

    How can I end an automatic renewal app from debiting my iTunes accounts. I no longer use the app, it's boring and takes too much time. it's about a month I haven't used it and I forgot I had it and now I can't find how to terminate this app? Today iT

  • Parental Controls for MacBook Pro

    Hello, My name is Matthew and this is a question coming from someone who currently does not have a MacBook Pro but is interested in getting one. I have an iPhone and it is working very well for me. I have a friend of mine put on a password to limit a