I have an implementation method that I want to return an
arraylist<String> from the DB.
Here is the method:
public ArrayList<String> greetClients() {
String result = "";
Connection conn = null;
Statement st = null;
String sql = "select distinct dealernumber from
financialaccount";
ArrayList<String> clients = new ArrayList<String>();
try{
Class.forName("com.mysql.jdbc.Driver");
conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/
DB", "user", "password");
st = conn.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
if(rs.getString(0)!=null){
clients.add(rs.getString(0));
}
}
//System.out.println(result);
st.close();
conn.close();
}catch(Exception e){
e.printStackTrace();
}
return clients;
}
When I try to create the methods in the other classes; in the Service
and ServiceAsync class I get this error:
Return type is not compatible with the AsyncCallback parameter from
GreetingServiceAsync.getClients
Here is are my classes:
GreetingService.java
package com.appcrown.dashboard.client;
import java.util.ArrayList;
import java.util.List;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
/**
* The client side stub for the RPC service.
*/
@RemoteServiceRelativePath("greet")
public interface GreetingService extends RemoteService {
String greetServer(String name);
ArrayList<String> getClients(); //gives error
}
GreetingServiceAsync.java
package com.appcrown.dashboard.client;
import java.util.ArrayList;
import com.google.gwt.user.client.rpc.AsyncCallback;
/**
* The async counterpart of <code>GreetingService</code>.
*/
public interface GreetingServiceAsync {
void greetServer(String input, AsyncCallback<String> callback);
void getClients(AsyncCallback<String> callback); //gives error
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---