I have a datatable with a button in each row:
<ice:dataTable ... var="item">
<ice:column>
<h:commandButton value="Download" action="#{mybean.downloadItem(item)}" />
</ice:column>
</ice:dataTable>
In the backing bean there's this method:
public void downloadItem(Item item) {
// ...
}
Everything works fine (when clicked the method is executed), but Eclipse validation fails with this strange message:
Method must have signature "String method(), String method(), String method(String), String method(String, String), String method(String, String, String), String method(String, String, String, String), String method(String, String, String, String, String), String method(String, String, String, String, String, String), String method(String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), String method(String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String)" but has signature "void method()"
What can I do?
If that's relevant, I'm using Eclipse Indigo SR1 on Tomcat 7.
Ignore it. Eclipse is a jerk. You can tone it by setting Window > Preferences > Web > JavaServer Faces Tools > Validation > Type Assignment Problems > Method expression signature incompatibility to Warning or Ignore (it defaults to Error).
Image borrowed from this blog in all courtesy.
The reason is, Eclipse expect the action
attribute to always return String
, not void
. Whilst indeed unspecified in JSF action
attribute, the EL method expressions themselves actually also support void
methods. The overzealous message in turn suggests that the underlying logic responsible for this validation is incapable of determining the individual method arguments and thus it tries to compare the raw method signature against a collection of allowed signatures, which ultimately get shown in the message if no match was found. Based on the message, this problem may also disappear when the method has 20 or more arguments ;)
This is fixed in Eclipse Luna SR1, nearly 6 years after the issue was reported. The severity has been decreased from Error to Warning. You may still want to put it yet lower to Ignore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With