a4j:commandLink正在从xhtml中删除javascript
如标题所示,当我单击a4j:commandLink时,该方法会完美地执行并更新我需要的表 问题在于,在a4j:commandLink发布到bean之后,页面的js正在消失 编辑:更清楚一点,当我的意思是js消失时,发生的是当我在Mozilla firebug中查找页面的javascript时,它没有显示出来。 这正常吗?我做错了什么?有什么最好的方法吗 代码是:a4j:commandLink正在从xhtml中删除javascript,java,jsf,richfaces,ajax4jsf,Java,Jsf,Richfaces,Ajax4jsf,如标题所示,当我单击a4j:commandLink时,该方法会完美地执行并更新我需要的表 问题在于,在a4j:commandLink发布到bean之后,页面的js正在消失 编辑:更清楚一点,当我的意思是js消失时,发生的是当我在Mozilla firebug中查找页面的javascript时,它没有显示出来。 这正常吗?我做错了什么?有什么最好的方法吗 代码是: <h:panelGroup id="examplePanel" > <h:panelGroup rendered="
<h:panelGroup id="examplePanel" >
<h:panelGroup rendered="#{not empty exampleBean.list}">
<table id="listDataTable" width="100%" cellspacing="0"
cellpadding="0" border="0" style="margin-left: 0pt; width: 716px;">
<thead>
<tr>
<th>col1</th>
<th>col2</th>
<th>col3</th>
<th class="shortCol">col4</th>
</tr>
</thead>
<tbody>
<a4j:repeat value="#{exampleBean.list}" rowKeyVar="itStatus" var="item">
<tr>
<td>
<h:outputText value="#{exampleBean.exampleShow(item)}" />
</td>
<td>
<h:outputText value="#{exampleBean.exampleShow(item)}" />
</td>
<td>
<h:outputText value="#{exampleBean.exampleShow(item)}" />
</td>
<td>
<h:commandLink action="#{exampleShow(item)}" ></h:commandLink>
</td>
</tr>
</a4j:repeat>
</tbody>
</table>
</h:panelGroup>
</h:panelGroup>
<h:outputLabel value="* #{locale.name}:" />
<h:inputText value="#{exampleBean.exampleName}"
disabled="#{not exampleBean.edit}" id="exampleName" />
<div class="button search">
**<a4j:commandLink action="#{exampleBean.objetToTable}" value="#{locale.create}" render="exampleTurnPanel" ></a4j:commandLink>**
</div>
可乐
可乐
可乐
可乐
****
在此之前,我使用的是一个h:commandLink,里面有一个f:ajax。但是有了这个,bean就没有这些值,因为POST永远不会完成。对吗
<h:commandLink action="#{exampleBean.objetToTable}" value="#{locale.create}">
<f:ajax execute="examplePanel" render="examplePanel" onevent="setExampleTableCss"/> </h:commandLink>
问候。我不知道你说的消失JavaScript到底是什么意思,但请注意,你的
更新了exampleTurnPanel
,而没有刷新整个页面。这意味着exampleTurnPanel
的新内容不受加载页面时执行的任何JavaScript的影响
如果您有一些JavaScript代码会影响exampleTurnPanel
的内容,那么您应该将其放在exampleTurnPanel
中,以便在面板的每次更新时运行它。或者,您可以在更新后使用
的oncomplete
属性显式调用它
在
的情况下,您需要
,尽管它不应该与
不同(注意,
中的onevent=“setExampleTableCss”
-在
的的oncomplete
中不需要它吗?)。我正在使用a4j:命令,因为我不想再次加载整个页面,只加载其中的表。我将尝试将js放在表中,看看会发生什么。如果将JavaScript代码移到exampleTurnPanel
组件之外,效果会更好。如果这不起作用,请隔离问题并确保它是
故障(或者不是)。