2014-01-15 46 views
0

我有一个xhtml文件,我用ui初始化它:重复标记realtime.all这个页面的标记放置在ui:fragment标记下。如何访问JSF中动态页面的内容?

<edges> 
    <ui:repeat value="#{graphInfoBean.edges}" var="edge" varStatus="indexVar"> 
     <edge id="#{indexVar.index}" source="#{edge.source}" target="#{edge.target}" 
       weight="#{edge.weight}"> 
      <attvalues> 
       <attvalue for="weight" value="#{edge.weight}"></attvalue> 
      </attvalues> 
     </edge> 
    </ui:repeat> 

当我进入这个网页,并保存为实时XML,而它被初始化,一切正常保存在XML文件中的标签是空的。

<edges> 
</edges> 

如何访问此xhtml文件的内容并将其保存在磁盘上?


认为,我们有2页(A & B),所以我们想通过页面下载页面B(此页由ManagedBean动态初始化)提前

感谢,

+0

我很困惑。所以你确实在屏幕上看到了那些边缘标签的内容,但是当你保存页面源时,那里什么都没有?如果是这样 - 这些边缘是否作为ajax请求的一部分呈现? – Gimby

+1

我使用了graph.xhtml作为模板文件,在sigmajs library.its中绘制图形,但是当我想要保存graph.xhtml时,标记的内容为空。 –

+0

您使用'parseGexf(url)'加载gexf文件或边缘在同一页面中吗? –

回答

2
function process(){ 
    url = "text.html" 
    var xhr = new XMLHttpRequest(); 
    xhr.open("GET", url, true); 
    xhr.onreadystatechange = function() { 
    if (xhr.readyState == 4){ 
     alert(xhr.responseText) 
     } 
    } 

    xhr.send(); 
    } 

对不起,我不能发表评论,也许你可以使用它。

看看这个帖子:get full html source code of page through ajax request through javascript

+0

谢谢@xild,我解决了这个问题,但我正在寻找'jsf'解决方案 –

+0

嗯,JSF不会在网页浏览器中运行,所以这是不可能的。 客户端x服务器端。 http://stackoverflow.com/questions/12920594/how-to-get-current-view-html-source-and-pass-it-jsf-mangedbean-as-string BaluSC在几年前发布了一个优雅的解决方案。 http://stackoverflow.com/questions/12920594/how-to-get-current-view-html-source-and-pass-it-jsf-mangedbean-as-string – xild