Method must have signature "String method()" but has signature "void method()"

4.8k Views Asked by At

In some of my jsf i have a form. when user fill the form he/she can click on the button. on the following you can see a example of code that i use :

<h:commandButton styleClass="btn btn-primary btn-block" value="#{msg['button.add.share']}" action="#{AddShareControler.add}" />  

And in the AddShareControler i have a method called add with following structure :

public void add() throws DaoImplNotFoundException, DataSourceException, IOException{
    share.setUserId(id);
    ShareDao dao=(ShareDao) Factory.getDao(ConfigReader.getConfig().getProperty("dao.share"));
    dao.add(share);
    FacesContext.getCurrentInstance().getExternalContext().redirect("share.jsf?uid="+share.getUserId());
}  

But eclipse kepler give me a error in my xhtml file. this is the error that kelper give me :

Method must have signature "String method()" but has signature "void method()"

I know what is the reason of this Error. Beacuase Add method return void. but why eclipse juno don't give me any error for the same code. And how i can resolve it in the kepler?

thanks.

1

There are 1 best solutions below

0
On

I've recently installed eclipse Kepler. Making a simple spring-jsf app for testing, eclipse gave me the same error. You can continue, deploy and execute the app. Restarting eclipse error disappear. Then I think is an eclipse bug.