JSF页面模板--html元刷新不起作用

时间:2017-10-16 23:51:37

标签: jsf

此处的模板

this.messaged.value

这是客户

sendmsg() {
  console.log('messaged', this.messaged);
  this.messaged += ' SENT!';
}

当我运行客户端页面元刷新不起作用时(每30秒刷新一次页面)。

我尝试将元刷新标记放在模板中(在h:head中),但是当运行客户端页面时,它不会刷新页面。

我是否应该尝试将元刷新标记放在客户端页面中的ui:composition标记内?

2 个答案:

答案 0 :(得分:0)

如果我在h:body中添加图像,就像这样

<?xml version='1.0' encoding='UTF-8' ?>
<!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"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html">

    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />        
        <title><ui:insert name="title">Default Title</ui:insert></title>
        <h:outputStylesheet library="css" name="jsfcrud.css"/>
    </h:head>

    <h:body>
        <h:graphicImage value = "resources/phonegirl1.PNG"/><br />
        <h1>
            <ui:insert name="title">Default Title</ui:insert>
        </h1>
        <p>
            <ui:insert name="body">Default Body</ui:insert>
        </p>
    </h:body>

</html>

并尝试在客户端页面中打开图像不存在。当我运行模板页面时,它不可见。

这可能有答案: Template content not displaying

答案 1 :(得分:0)

如果我添加文字&#34; Hello World&#34;在模板中如此

<?xml version='1.0' encoding='UTF-8' ?>
<!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"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html">

    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />        
        <title><ui:insert name="title">Default Title</ui:insert></title>
        <h:outputStylesheet library="css" name="jsfcrud.css"/>                        
    </h:head>

    <h:body>
        Hello World!
        <h1>
            <ui:insert name="title">Default Title</ui:insert>
        </h1>        
        <p>
            <ui:insert name="body">Default Body</ui:insert>
        </p>
    </h:body>

</html>

每个引用模板的客户端页面都在其页面上写了Hello World。

但如果我在其中一个客户页面上尝试相同的操作,那么他们就无法工作。