Problem in displaying html page in JEditorPane....

Hi All,
i was trying to display a html page in a JEditorPane. i was able to do that when i'm displaying a html page from a local machine.. But when i try to get the page from some website, it giving me
"exception access denied (java.net.SocketPermission www.java.sun.com resolve)"
exception. But if i run the same code thru JBuilder, its working. But thru appletviewer or thru IE or Netscape its throwing the error.. Any suggestion or help is highly appreciated....
Thanks
Ragu

Java Applets are very secure, what is good. Java applets are extremely secure
what is bad. So Applet cannot open TCP connection to any host rather than its
home host. So you cannot get the resources from any other server (what is common to
HTTP).
In JBuilder iit works cause JBuilder is used for development and security in deevelopment
is not an issue. But it confuses then you see.
vpanasenko_even

Similar Messages

  • Displaying html page in JEditorPane

    yeh, yeh, i know the editorPane.setPage(url) function. the problem is that the file i need to display (help.html) is on local drive, in the same dir as the class with the editorPane. so what url do i make [i don't know in which dir the class will be]. i tried to make it relative: URL url = new URL("help.html"), but it didn't work. this:
    s = "file:\\"
    + System.getProperty("user.dir")
    + System.getProperty("file.separator")
    + "Help.html";
    URL helpURL = new URL(s);
    doesn't work either.
    i work on win 95, jdk 1.3.
    HELP ME!
    LionAlx.

    yeh, yeh, i know the editorPane.setPage(url) function.
    the problem is that the file i need to display
    (help.html) is on local drive, in the same dir as the
    class with the editorPane. so what url do i make [i
    don't know in which dir the class will be]. i tried to
    make it relative: URL url = new URL("help.html"), but
    it didn't work. this:
    s = "file:\\"Try "file:\\\"

  • Problem Printing html page with JEditorPane...

    Hello All,
    I Have a problem in printin html file with JEditorPane...
    My Html file contains a Table on it..
    Problem is that JEditorPane displays the html file correctly but
    it prints the file without print that Table..
    So pls help me...
    Thanx in advance,..
    Amit
    [email protected]

    I think you would know how to retrieve content of an HTML page using the URL object. Just in case.
    My apology if this short note doesn't help you at all.

  • Working with JEditorPane to display HTML page

    iam loading html page into JEditorPane .
    how to get the html form data to validate
    give me soluation for this problem ...
    thanks ....
    karthi

    Search for occurences of <img> tags in the stream and replace its src="" contents by for example src="image?id=orginatingimagefilenameorso" and write kind of an ImageServlet mapped on "/image*" which streams the right images to the response.
    You may find this ImageServlet example useful: http://balusc.blogspot.com/2007/04/imageservlet.html
    After all, why are you streaming HTML files through a servlet instead of just linking to them? Aren't they public accessible or so? If this is the case, consider creating a virtual host on the application server so that you can just access those files through a simple plain vanilla URL.

  • How to display HTML pages always in first rank in search result?

    I have a sharepoint 2010 site where search is configured, but when it is displaying the search result some time it is  showing the pdf files  in the first order and the html pages in the second order, I need to display html pages always
    in the first order.How can I accomplish it?

    Alex's link is by far the best one but this is an alternative if you wanted to read a bit more widely
    http://sharepointkaos.wordpress.com/2011/01/13/custom-ranking-model/
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • How to go to anchor html link from external html page in JEditorPane

    Hi people,
    I've been trying to jump to an anchor link from an external html page in JEditorPane, and I cannot get it working, I'm sure it can be done somehow...
    The HTML page has a link like:
    Hello
    and this is loaded into JEditorPane ok.
    The HyperlinkListener implementation:
    public void hyperlinkUpdate( HyperlinkEvent e )
    try {
    if ( e.getEventType() == HyperlinkEvent.EventType.ACTIVATED )
    editorPane_.setPage( getClass().getResource(
    MyDialog.this.getBaseURL().concat( e.getURL().getFile().substring(
    e.getURL().getFile().lastIndexOf( "/" ) + 1 ) ) ) );
    if ( e.getURL().getRef() != null )
    editorPane_.scrollToReference( e.getURL().getRef() );
    else return;
    } catch ( IOException ioe ) { ioe.printStackTrace(); }
    This code loads the new html file ok, but it does not scroll to the anchor. The MyDialog.this.getBaseURL() just returns something like com.name.package, I construct the URL by using this base url and the name of the html file to open.
    ANy help, thanks

    he! I'm not alone in my desperation. Take a look at my problem:
    I've got a JEditorPane (not editable) inside a JFrame. The JEditorPane is loaded with the HTML text and all the links to anchors are working properly when I click on them.
    BUT
    If I try to go to an anchor from outside this JFrame I can see how the JEditorPane scrolls to the right anchor and suddenly it scrolls back to the place where the caret was located!!!
    The "funny thing" is that my code is working in jdk1.3.1 but this is happening in jdk1.4.2. Is it a bug?!?!?!
    How could I figure out what position I have to set the caret to for every anchor in order to get the scroll working correctly???
    My implementation of hyperlinkUpdate (working properly, here isn't the problem):
       jEditorPane.addHyperlinkListener(new HyperlinkListener() {
          public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
              MiEditorPane src = (MiEditorPane)e.getSource();
              src.goToAnchor(e.getDescription().substring(1));
        });My object jEditorPane is an instance of this class:
      class MiEditorPane extends JEditorPane {
        MiEditorPane() {
          super();
        public void goToAnchor(String anchor) {
          super.scrollToReference(anchor);
      }And this is the method I call from outside the JFrame containing the JEditorPane:
      public void goToAnchor(String anchor) {
         jEditorPane.goToAnchor(anchor);
      }Any help greatly appreciated ...

  • Display HTML Tables In JEditorPane

    Hi all,
    I am Editing an HTML Document in a JEditorPane.I've Noticed that The HTMLEditorKit has many flaws.
    I tried to fill them by registering my own tag actions for some tags. Now the new problem that I am facing is how an html table is displayed : The cellborders ares not visible. So i can see the content of the table, but not its borders. What should I do to make them show out ?
    thanx

    I had some problems with using HTML Tables with JEditorPane (it's really flaky). What I found was you have to be very specific when you create the table. Meaning, the cells have to be set using exact pixel sizes, not relative sizes or percentages. This is a pain, but if you do that then it should work.
    <table width=400 border=1 cellspacing=0 cellpadding=1> etc.......m

  • 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

  • Displaying HTML page when server is unavailable

    Hi,
    I would like to display the static html page when the server is down. For example when server maintanance is going on I would like to display html page with information
    Please let me know what is the process to achive this.
    Thanks

    You might also want to check Custom Error pages:
    http://help.sap.com/saphelp_nw70/helpdata/EN/9a/e74d426332bd30e10000000a155106/frameset.htm
    Regards,
    Siddhesh

  • I am using IFrame and displayed Html page

    Hi Friends
                        I am using IFrame and displayed Html page in flex4
                        In this page open to Firefox But not IE please help me.
                          Thanks
                           V.ChandraSekhar

    You have deleted your page, but you have not deleted your page?
    Which is it?
    If you never saved it it is gone. If you saved it in Lion (OSX 10.7) with Pages 09 v4.1, there should be versions available when you mouse overv the document name at the top of the window.
    Peter

  • Regarding displaying html page in a JEditorPane

    i want to display a html page in a JEditorPane but the problem is it is displying the page but the script part of html page is printed as it is in the pane . please tell the solution for it . i will be highly thankful to u.

    What you are doing exactly? you are displaying the html file into a JEditorPane or After displaying you are tring to Print it out in the Paper or what.
    If this the First Sinario then this code will help you.
    import javax.swing.*;
    import java.awt.*;
    import java.net.URL;
    import java.net.MalformedURLException;
    import java.io.*;
    import javax.swing.text.*;
    import javax.swing.event.*;
    public class Htmlexample extends JInternalFrame {
         //Constructor of Class.
         public Htmlexample () {
              //super(Title, Resizable, Closable, Maximizable, Iconifiable)
              super (title, true, true, true, true);
              setSize (500, 350);
              HtmlPane html = new HtmlPane ("Help/Keys.htm");     
              setContentPane (html);                    
              setVisible (true);
    //Following Class Show HTML Help inside an EditorPane.
    class HtmlPane extends JScrollPane implements HyperlinkListener {
         JEditorPane html;
         public HtmlPane (String filename) {
              try {
                   File f = new File (filename);          
                   String s = f.getAbsolutePath();          
                   s = "file:" + s;
                   URL url = new URL (s);               
                   html = new JEditorPane (s);          
                   html.setEditable (false);          
                   html.addHyperlinkListener (this);
                   JViewport vp = getViewport();     
                   vp.add (html);                    
              catch (MalformedURLException e) { }
              catch (IOException e) {     }
         //Function Perform By the HyperLinks of HTML Help File.
         public void hyperlinkUpdate (HyperlinkEvent e) {
              if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                   linkActivated (e.getURL());
         //Function for Loading other HTML Pages in Your HTML Help.
         protected void linkActivated (URL u) {
              Cursor c = html.getCursor();
              Cursor waitCursor = Cursor.getPredefinedCursor (Cursor.WAIT_CURSOR);
              html.setCursor (waitCursor);
              SwingUtilities.invokeLater (new PageLoader (u, c));
         //Following Class Load Other Pages Included in Our HTML Help File.
         class PageLoader implements Runnable {
              //Constructor of Class.
              PageLoader (URL u, Cursor c) {
                   url = u;
                   cursor = c;
              public void run () {
                   if (url == null) {
                        html.setCursor (cursor);
                        Container parent = html.getParent();
                        parent.repaint();
                   else {
                        Document doc = html.getDocument();
                        try {
                             html.setPage (url);
                        catch (IOException ioe) {
                             html.setDocument (doc);
                             getToolkit().beep();
                        finally {
                             url = null;
                             SwingUtilities.invokeLater (this);
              URL url;
              Cursor cursor;
    }if there is any other issue Let me Know
    Thank you
    Jofin

  • Displaying HTML Page

    I am having problems getting my HTML file to actually display. I think I can retrieve the file properly - I'm not getting any errors saying I can't. But when I do retrieve it, I just get a white scrollpane, instead of a scrollpane containing the webpage it should be. The following code is for an object constructor that creates the window that shows the webpage. Any help would be greatly appreciated. Thanks.
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.net.URL;
    import java.io.IOException;
    public class OnlineHelpWindow extends JFrame
         public OnlineHelpWindow()
              super("Online Help");
              Container c = getContentPane();
              JEditorPane editorPane = new JEditorPane();
              editorPane.setEditable(false);
              String s = null;
              try
                   String prefix = "file:" + System.getProperty("user.dir") + System.getProperty("file.separator");
                   URL url = new URL( prefix + "index.html" );
                   System.out.println(url);
              catch (Exception e )
                   JOptionPane.showMessageDialog(null, "Unable to load URL: " + s,
                                                                "Unable to load URL",JOptionPane.WARNING_MESSAGE);
              JScrollPane editorScrollPane = new JScrollPane(editorPane);
              editorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
              editorScrollPane.setPreferredSize(new Dimension(250, 145));
              editorScrollPane.setMinimumSize(new Dimension(10, 10));
              c.add(editorScrollPane);
              pack();
              show();
    }

    I think you forgot to put the html page in the editor
    try putting the url in the constructor, so the url must be define first.
    JEditorPane editorPane = new JEditorPane(url);
    It should work
    Joey

  • Problem with display of pages in IE

    I'll keep this short and simple, I'm not after criticism of my work but if it is a mess then I understand, I've re-coded a website designed by a friend who has joined the army & is currently serving so I cannot get in touch with him for help, I'm a novice website designer but I'm stumped as to why my pages are behaving the way they are
    I've made a website for a friend's pub and it all looked brilliant in DreamWeaver CS5's Design View so I went ahead and used ftp program FileZilla to send it live on my domain and basically it shifted my pictures and it displays differently in IE to what it does in Chrome e.g. My "Find Us" page has a large white bar at the bottom in IE which shouldn't be there and I can't get rid of it, but it doesn't show in chrome?
    Any help or code I may be able to implement would be greatly appreciated, thanks Freecey.
    Edit: Forgot to add the link to my site - www.thelightdragoon.co.uk
    Also I am aware of the problems with the Home Page & the Menu Page but I am yet to attempt to fix those yet.

    You still have a problem on that page.
    <head>
    <meta name="generator" content="HTML Tidy for Linux (vers 25 March 2009), see www.w3.org" /><object type="{0C55C096-0F1D-4F28-AAA2-85EF591126E7}" id="cosymantecbfw" class="c1"></object>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    Note that you STILL have an <object> tag within the head region.  That's invalid.
    Also, you are using absolute positioning to place elements within your header region - that's definitely suboptimal and unnecessary since it precludes centering the page in various width viewports.  However, if you make the following changes you can muddle by -
    1.  Change the CSS for #outerShadow to set the left/right margins to "auto".  Make it position:relative.
    2.  Change the left values for the absolutely positioned elements to whatever you need for them to be correctly located within #outerShadow.
    3.  Twiddle the remaining out of place element margins to locate them correctly within #outerShadow.
    That should do it.  But the real way to build this page is without using absolute positioning at all.  It's not necessary and will always make your maintenance more complicated as long as you have it.

  • Displaying html page with in the applet

    I want to open an html page in the applet. If i use showDocument() of applet, it opens the html page in the browser, but i want to open the html page with in the applet(i.e., applet should display the html page). Is there any way which i can do the above thing.
    Thanks in advance

    Look at this sample:
    import java.awt.*;
    import java.net.*;
    import java.io.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.text.*;
    public class BrwsA extends JApplet
         JPanel      jpa = new JPanel();
         JEditorPane jed = new JEditorPane();
         JScrollPane jsp = new JScrollPane(jpa);
    public BrwsA()
         jpa.setLayout(new BorderLayout());
         jpa.add(jed);
         jpa.setPreferredSize(new Dimension(800,1000));
         jed.setEditable(false);
         jed.setContentType("text/html");
         jed.getEditorKit().createDefaultDocument();
         setContentPane(jsp);
    public void init()
         try
              URL url = new URL(getCodeBase(),"test.html");
              jed.setPage(url);
         catch(MalformedURLException e)
         catch(IOException e)
    }Noah

  • IPhone SDK - Display HTML page from WITHIN package

    Hi all,
    As part of my iPhone app, I want to display an HTML page.
    Now, I've got a browser component working just fine, and have no problem displaying anything on the web, but i don't know how to reference an html page that is WITHIN my application package.
    I'd much rather do it this way, so that my app can be used offline.
    I'm sure its a simple thing to do... anyone know what i need to do here to make this work?

    NSString *welcomeFile = [bundle pathForResource:@"welcome" ofType:@"html" inDirectory:@"files"];
    NSString *content = [NSString stringWithContentsOfURL:[NSURL fileURLWithPath:welcomeFile]];
    NSString *baseUrl = [bundle pathForResource:@"files" ofType:nil];
    [webView loadHTMLString:content baseURL:[NSURL fileURLWithPath:baseUrl]];

Maybe you are looking for