简体   繁体   English

JavaFX WebView无法正确呈现JSF页面(用符号代替Bean的值)

[英]JavaFX WebView doesn't render JSF page correctly (symbols instead of values from beans)

I have created very simple app that is displaying URL using JavaFX WebView: 我创建了一个非常简单的应用程序,该应用程序使用JavaFX WebView显示URL:

static JFXPanel fxPanel;
static WebView wv;
static JFrame frame;

public static void main(String[] args){
     try {
          fxPanel = new JFXPanel ();
          com.sun.javafx.application.PlatformImpl.runLater ( new Runnable () {
               @Override
               public void run () {
                    wv = new WebView ();
                    wv.getEngine ().load ( "http://localhost:8080/WebApp/" );
                    fxPanel.setScene ( new Scene ( wv, 1000, 750 ) );
                    frame = new JFrame ( "Google" );
                    frame.add ( new JScrollPane ( fxPanel ) );
                    frame.setDefaultCloseOperation ( JFrame.EXIT_ON_CLOSE );
                    frame.setVisible ( true );
                    frame.pack ();
               }
           } );
     } catch ( Exception ex ) {
}

I use it to render a webpage with my JSF application. 我用它用我的JSF应用程序渲染网页。 App renders perfectly using a web browser, however it fails when rendered from JFXPanel. 应用可以使用Web浏览器完美呈现,但是从JFXPanel呈现时会失败。

Funny thing is that texts fetched from backing beans are not rendered correctly, where resources from message bundle are displayed OK. 有趣的是,从后备Bean提取的文本未正确呈现,消息包中的资源显示为OK。 Please see attached screenshots. 请参阅所附的屏幕截图。 Wrong Display and Correct Display 错误的显示正确的显示

I have found this answer and it solves my question. 我找到了这个答案,它解决了我的问题。

The problem is with loading fonts that is messing the WebView. 问题在于加载使WebView混乱的字体。 Solution was removing links to external fonts that I had on my page. 解决方案是删除指向页面上的外部字体的链接。

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

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