Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.7.2
-
Fix Version/s: 1.8
-
Component/s: None
-
Labels:None
-
Environment:Windows XP
Description
Hi,
I've raised this on the forum http://www.icefaces.org/JForum/posts/list/10503.page#42949
We've recently upgraded to SWF 2.0 and menuItems no longer work, they are displayed correctly, but the actionListener never gets fired when the item is selected. I've cut this down into a very simple test case which demonstrates the issue
Code:
index.jsp
<%@ taglib prefix='c' uri='http://java.sun.com/jstl/core_rt'%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<jsp:forward page="/spring/menuItem-flow" />
Code:
menuItem-flow.xml
<?xml version="1.0" encoding="UTF-8"?>
<webflow:flow
xmlns:webflow="http://www.springframework.org/schema/webflow"
xmlns:ns0="http://www.w3.org/2001/XMLSchema-instance"
ns0:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
start-state="dashboardEntry">
<webflow:persistence-context/>
<webflow:view-state id="dashboardEntry" view="/pages/menuItem.jspx" />
<webflow:end-state id="mainFlow" view="flowRedirect:main-flow" />
<webflow:global-transitions>
<webflow:transition on="mainFlow" to="mainFlow" />
</webflow:global-transitions>
</webflow:flow>
Code:
import java.util.ArrayList;
import java.util.List;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ActionEvent;
import javax.faces.event.ActionListener;
import org.springframework.stereotype.Component;
import com.icesoft.faces.component.menubar.MenuItem;
@Component
public class OtherBean {
private List<MenuItem> its = null;
public List<MenuItem> getOther() {
if (its == null) {
its = new ArrayList<MenuItem>();
MenuItem one = new MenuItem();
one.setValue("Menu1");
MenuItem two = new MenuItem();
two.addActionListener(new ActionListener() {
public void processAction(ActionEvent arg0) throws AbortProcessingException {
// TODO Auto-generated method stub
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!HERE2");
}
});
two.setValue("Item1");
one.getChildren().add(two);
its.add(one);
}
return its;
}
}
I've raised this on the forum http://www.icefaces.org/JForum/posts/list/10503.page#42949
We've recently upgraded to SWF 2.0 and menuItems no longer work, they are displayed correctly, but the actionListener never gets fired when the item is selected. I've cut this down into a very simple test case which demonstrates the issue
Code:
index.jsp
<%@ taglib prefix='c' uri='http://java.sun.com/jstl/core_rt'%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<jsp:forward page="/spring/menuItem-flow" />
Code:
menuItem-flow.xml
<?xml version="1.0" encoding="UTF-8"?>
<webflow:flow
xmlns:webflow="http://www.springframework.org/schema/webflow"
xmlns:ns0="http://www.w3.org/2001/XMLSchema-instance"
ns0:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
start-state="dashboardEntry">
<webflow:persistence-context/>
<webflow:view-state id="dashboardEntry" view="/pages/menuItem.jspx" />
<webflow:end-state id="mainFlow" view="flowRedirect:main-flow" />
<webflow:global-transitions>
<webflow:transition on="mainFlow" to="mainFlow" />
</webflow:global-transitions>
</webflow:flow>
Code:
import java.util.ArrayList;
import java.util.List;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ActionEvent;
import javax.faces.event.ActionListener;
import org.springframework.stereotype.Component;
import com.icesoft.faces.component.menubar.MenuItem;
@Component
public class OtherBean {
private List<MenuItem> its = null;
public List<MenuItem> getOther() {
if (its == null) {
its = new ArrayList<MenuItem>();
MenuItem one = new MenuItem();
one.setValue("Menu1");
MenuItem two = new MenuItem();
two.addActionListener(new ActionListener() {
public void processAction(ActionEvent arg0) throws AbortProcessingException {
// TODO Auto-generated method stub
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!HERE2");
}
});
two.setValue("Item1");
one.getChildren().add(two);
its.add(one);
}
return its;
}
}
I have made a comment in the forum about this. I think the problem is about saving and restoring state.
I got the MenuItem working with SWF 2.0.5 by implementing save and restore state. See the thread in the forum for more details.