I'm getting this error with f:setPropertyActionListener and i can't figure out why:
HTTP Status 500 - For input string: "selectedItem"
exception:
javax.servlet.ServletException: For input string: "selectedItem"
javax.faces.webapp.FacesServlet.service(FacesServlet.java:667)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause:
java.lang.NumberFormatException: For input string: "selectedItem"
java.lang.NumberFormatException.forInputString(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
javax.el.ListELResolver.coerce(ListELResolver.java:157)
javax.el.ListELResolver.getType(ListELResolver.java:50)
com.sun.faces.el.DemuxCompositeELResolver._getType(DemuxCompositeELResolver.java:215)
com.sun.faces.el.DemuxCompositeELResolver.getType(DemuxCompositeELResolver.java:242)
org.apache.el.parser.AstValue.getType(AstValue.java:60)
org.apache.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:168)
com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:98)
com.sun.faces.facelets.tag.jsf.core.SetPropertyActionListenerHandler$SetPropertyListener.processAction(SetPropertyActionListenerHandler.java:209)
javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:813)
javax.faces.component.UICommand.broadcast(UICommand.java:300)
javax.faces.component.UIData.broadcast(UIData.java:1108)
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:654)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Table Class:
// imports omitted
public class Table<E> extends ArrayList<E> {
private E selectedItem;
public E getSelectedItem() { return selectedItem; }
public void setSelectedItem(E value) { selectedItem = value; }
}
MyTable Bean:
// Imports omitted
@ManagedBean
@ViewScoped
public class MyTable extends Table<File> {
@PostConstruct
public void initBean() {
// Loading some files into the list
}
}
This is the XHTML:
<html> <!-- Namespaces and stuff omitted -->
<h:head>...</h:head>
<h:body>
<h:form>
<h:dataTable var="item" value="#{myTable}">
<h:column>
<h:commandButton value="Try Me!">
<f:setPropertyActionListener value="#{item}" target="#{myTable.selectedItem}"/>
<!-- I'm getting a warning from eclipse here: property not found -->
</h:commandButton>
</h:column>
</h:dataTable>
</h:form>
</h:body>
</html>
I'm using Eclipse Luna (Java EE IDE) with Tomcat 8 and JSF 2.2.11 (mojarra). Any hints are accepted, thank you!