Hi,
I have narrowed down my production code, so you can try the problem.
page1.xhtml:
<!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:h="
http://java.sun.com/jsf/html"
xmlns:f="
http://java.sun.com/jsf/core"
xmlns:ui="
http://java.sun.com/jsf/facelets">
<h:head>
<title></title>
</h:head>
<h:body>
<h:outputScript library="javascript" name="test.js" target="head" />
<h:form>
<ui:repeat value="#{testBean.numbers}" var="number">
#{number}
</ui:repeat>
<h:commandLink value="popup" onclick="showPopup('page2.xhtml'); return false;">
</h:commandLink>
</h:form>
</h:body>
</html>
page2.xhtml:
<!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:h="
http://java.sun.com/jsf/html"
xmlns:f="
http://java.sun.com/jsf/core"
xmlns:ui="
http://java.sun.com/jsf/facelets">
<h:head>
<title></title>
</h:head>
<h:body>
<h:outputScript library="javascript" name="test.js" target="head" />
<h:form>
<h:commandButton action="#{testBean.delNumber}" value="Delete Number" onclick="closeAndRefresh();"/>
</h:form>
</h:body>
</html>
test.js:
function closeAndRefresh() {
opener.location.reload(true);
self.close();
}
function showPopup(target) {
var features = "height="+300+",width="+400+",status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes";
var winId = window.open(target, 'popup', features);
}
TestBean.java:
package minosites.view;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@ManagedBean
@SessionScoped
public class TestBean {
List<String> numbers = new ArrayList<String>();
public List<String> getNumbers() {
return numbers;
}
public void setNumbers(List<String> numbers) {
this.numbers = numbers;
}
public String delNumber() {
this.numbers.remove(0);
return null;
}
@PostConstruct
public void init() {
numbers.add("1");
numbers.add("2");
numbers.add("3");
}
}
When you hit "Delete Number", i want to refresh the opener page, and see the result immediately. It seems the number is deleted correctly, but the page shows the previous state.
When i do a refresh manually, by doing a GET, the right state shows up.
Any idea?
[Message sent by forum member 'gabox01' (beres.gabor_at_gmail.com)]
http://forums.java.net/jive/thread.jspa?messageID=366893