<a4j:commandButton id="save" value="save"
action="#{objectHome.persist()}"
rendered="#{!objectHome.managed}"
disabled="#{!objectHome.wired}"
oncomplete= "myfunction(#{objectHome.instance.idd})">
</a4j:commandButton>
<script language="javascript" type="text/javascript">
function myfunction(x)
{
window.location.replace("http://localhost:8080/projet/doc.seam?ObjectIdd="+x+" ");
}
/////and in my file.page.xml
<navigation from-action="#{objectHome.persist()}">
<rule if-outcome="persisted">
<end-conversation/>
<redirect view-id="/filepdf.xhtml"/>
</rule>
</navigation>
问题是当我单击保存按钮时,重定向filepdf.xml
成功但oncomplete
无法调用myfunction
(这是同一页面中的重定向)。