在页面中找不到BODY标记

时间:2013-06-24 09:12:19

标签: java-me lwuit

  

我有一个应该加载和显示下载的html页面的LWUIT应用程序。

     

所以我创建了一个html页面,并在src dir(与我的java类相同的目录)中进行了推送。

返回

  

要加载我使用的页面htmlC.setPage(“jar:///mypage.html”);

返回

  

但我收到了错误

页面中未找到BODY标记。

import com.sun.lwuit.layouts.*;

import  com.sun.lwuit.html.*;

import javax.microedition.midlet.*;


public class HelloLWUITMidlet3 extends MIDlet

{

  public void startApp()

  {

   com.sun.lwuit.Display.init(this);

  final com.sun.lwuit.Form form = new com.sun.lwuit.Form("");



   final com.sun.lwuit.html.HTMLComponent htmlC = new com.sun.lwuit.html.HTMLComponent(   );



   DocumentInfo docInfo = htmlC.getDocumentInfo() ;

   DocumentRequestHandler handler =htmlC.getRequestHandler();

   htmlC.setRTL(true);


   htmlC.setPage("jar:///mypage.html");

    form.addComponent(htmlC);


    BorderLayout bl = new BorderLayout();

    form.setScrollable(true);


    form.show( );

  }

  public void pauseApp()
  {

  }

 public void destroyApp(boolean unconditional) {


 }


 }

1 个答案:

答案 0 :(得分:0)

似乎html文件没有body标签,要么包含它,要么你可以获取内容并将其包装在body标签中。

相关问题