我有我的JSF:
<h:commandButton value="Add to Cart"
rendered="#{movieDisplayController.movie.available != 0}"
action="#{cartController.addMovie(movieDisplayController.movie, '2')}">
</h:commandButton>
action
在eclipse(kepler JEE)中用红色加下划线并显示:
方法必须有签名“String method(),String method(),String method(String),String method(String,String),String方法(String,String,String),String方法(String,String,String, String),String方法(String,String,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方法(String,String,String,String,String, String,String,String,String,String),String方法(String,String,String,String,String,String,String, String,String,String,String),String方法(String,String,String,String,String,String,String,String, String,String,String,String),String方法(String,String,String,String,String,String,String,String, String,String,String,String,String),String方法(String,String,String,String,String,String,String, String,String,String,String,String,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,String,String,String,String,String,String,String,String,String,String, String,String,String,String,String),String方法(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,String)“但具有签名”字符串方法(电影,整数)“
该方法定义为:
public String addMovie(Movie movie, Integer quantity) {
//...
return null;
}
当我按下按钮时它正确运行 - 这是日食中的错误还是我做错了什么?
编辑:正确运行:
action="#{cartController.addMovie(movieDisplayController.movie, 2)}">
和
action="#{cartController.addMovie(movieDisplayController.movie,
movieDisplayController.quantity)}">
太过reported
答案 0 :(得分:1)
在Passing parameter to JSF action
中引用@BalusC当您使用web.xml定位Servlet 3.0容器(Tomcat 7,Glassfish 3,JBoss AS 6等)时,其根声明定义Servlet 3.0,那么您应该能够直接将参数传递给EL的动作方法,因为EL 2.2支持它(它是Servlet 3.0的一部分)。
你的方式应该是完全正确的,我想这是eclipse kepler中的一个错误。