简体   繁体   English

从CodeNameOne访问网页

[英]Access of webpage from CodeNameOne

I am trying to access a web page from CodeNameOne application. 我正在尝试从CodeNameOne应用程序访问网页。 Strangely the simulator is throwing errors whereas the application is working fine in andriod mobile. 奇怪的是,模拟器引发错误,而应用程序在Andriod Mobile中运行良好。

Code Snippet: 代码段:

Form loginForm = new Form("LoginNew"); 表单loginForm = new Form(“ LoginNew”); loginForm.setLayout(new BorderLayout()); loginForm.setLayout(new BorderLayout()); WebBrowser browser = new WebBrowser() browser.setURL(" http://mobile.apps-tek.com:8081/apps-webservices "); WebBrowser浏览器=新的WebBrowser()browser.setURL(“ http://mobile.apps-tek.com:8081/apps-webservices ”); loginForm.addComponent(BorderLayout.CENTER,browser); loginForm.addComponent(BorderLayout.CENTER,浏览器); loginForm.show(); loginForm.show();

Error while running in simulator. 在模拟器中运行时出错。

Attribute 'xmlns' is not supported for tag 'html'.
The tag 'script' is not supported in XHTML-MP 1.0
The tag 'script' is not supported in XHTML-MP 1.0
Attribute 'onload' is not supported for tag 'body'.
Attribute 'name' is not supported for tag 'form'.
The tag 'script' is not supported in XHTML-MP 1.0
The tag 'script' is not supported in XHTML-MP 1.0
The tag 'script' is not supported in XHTML-MP 1.0
Attribute 'onclick' is not supported for tag 'input'.
The tag 'script' is not supported in XHTML-MP 1.0
java.lang.NullPointerException
    at com.codename1.impl.javase.JavaSEPort.scale(JavaSEPort.java:3047)
    at com.codename1.ui.Image.scale(Image.java:930)
    at com.codename1.ui.Image.scaled(Image.java:900)
    at com.codename1.ui.html.ResourceThreadQueue$ResourceThread.handleImage(ResourceThreadQueue.java:562)
    at com.codename1.ui.html.ResourceThreadQueue$ResourceThread.handleImage(ResourceThreadQueue.java:511)
    at com.codename1.ui.html.ResourceThreadQueue$ResourceThread.access$000(ResourceThreadQueue.java:360)
    at com.codename1.ui.html.ResourceThreadQueue$ResourceThread$1.run(ResourceThreadQueue.java:479)
    at com.codename1.ui.Display.processSerialCalls(Display.java:1075)
    at com.codename1.ui.Display.edtLoopImpl(Display.java:1019)
    at com.codename1.ui.Display.mainEDTLoop(Display.java:925)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
    at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
[EDT] 0:0:0,0 - Exception in AppName version 1.0
[EDT] 0:0:0,1 - OS ios
[EDT] 0:0:0,1 - Error java.lang.NullPointerException
[EDT] 0:0:0,1 - Current Form null
[EDT] 0:0:0,1 - Exception: java.lang.NullPointerException - null
java.lang.NullPointerException
    at com.codename1.impl.javase.JavaSEPort.scale(JavaSEPort.java:3047)
    at com.codename1.ui.Image.scale(Image.java:930)
    at com.codename1.ui.Image.scaled(Image.java:900)
    at com.codename1.ui.html.ResourceThreadQueue$ResourceThread.handleImage(ResourceThreadQueue.java:562)
    at com.codename1.ui.html.ResourceThreadQueue$ResourceThread.handleImage(ResourceThreadQueue.java:511)
    at com.codename1.ui.html.ResourceThreadQueue$ResourceThread.access$000(ResourceThreadQueue.java:360)
    at com.codename1.ui.html.ResourceThreadQueue$ResourceThread$1.run(ResourceThreadQueue.java:479)
    at com.codename1.ui.Display.processSerialCalls(Display.java:1075)
    at com.codename1.ui.Display.edtLoopImpl(Display.java:1019)
    at com.codename1.ui.Display.mainEDTLoop(Display.java:925)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
    at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)

It seems you are using Java 6 or Java 7 that is configured without Java FX support. 似乎您正在使用配置为不支持Java FX的Java 6或Java 7。 When running without Java FX Codename One defaults to the feature phone web browser component which is pretty limited and problematic. 在没有Java FX Codename的情况下运行时,默认情况下功能电话Web浏览器组件非常有限且存在问题。

Make sure that the VM used to run Codename One is Java SE 7 and that the additional Java FX libraries are included there. 确保用于运行代号为One的VM为Java SE 7,并且其中包含其他Java FX库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM