hello
i your entrypoint u can't use an complex object because it will be convert to javascript , so i suggest u to create an object under the shared package and it need to contain just a simple attribute (string,long,List,Array....) no connection object and this object will play the role of a transporter of your information between client and server
--
Le 25 avril 2012 09:36, alaa aadil <aadilalaa@gmail.com> a écrit :
hello
i'm new to GWT , i create a simple project GWT, , and on my package
Server , i add a java Class "Connect",
this Class connect to a DataBase and return to me some information ,
( when i compile this class alone with a java Application it works
fine )
but when i compile all the project as a Web Application ,i get this
Error :
:10:16:05.004 [ERROR] [gwtpostgre] Line 31: No source code is
available for type com.qualisteo.GwtPostgre.server.Connect; did you
forget to inherit a required module?
Please Help me
this is my EntryPoint :
public class GwtPostgre implements EntryPoint {
Connect app= new Connect();
String text=app.getInformation();
public void onModuleLoad() {
final Button sendButton = new Button("Send");
final TextBox nameField = new TextBox();
nameField.setText("text");
}
}
this is my Class Connect Onthe Package Server :
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
public class Connect {
public String Inforeturn;
public Connect ()
{
this.Inforeturn=null;
}
public String getInformation()
{
try {
Class.forName("org.postgresql.Driver");
String url = "jdbc:postgresql://localhost:5433/postgres";
String user = "postgres";
String passwd = "quali2012";
Connection conn = DriverManager.getConnection(url, user, passwd);
//Création d'un objet Statement
Statement state = conn.createStatement();
//L'objet ResultSet contient le résultat de la requête SQL
ResultSet result = state.executeQuery("SELECT id FROM ecole WHERE
id=( SELECT max(id_2) FROM ecole )");
//On récupère les MetaData
ResultSetMetaData resultMeta = result.getMetaData();
//System.out.println("\n**********************************");
//On affiche le nom des colonnes
//for(int i = 1; i <= resultMeta.getColumnCount(); i++)
//System.out.print("\t" +
resultMeta.getColumnName(i).toUpperCase() + "\t *");
//System.out.println("\n**********************************");
while(result.next()){
for(int i = 1; i <= resultMeta.getColumnCount(); i++)
{
Inforeturn=result.getObject(i).toString();
}
System.out.println("\n---------------------------------");
}
result.close();
state.close();
} catch (Exception e) {
e.printStackTrace();
}
return Inforeturn;
}
}
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Akram MONCER
Personne
Personne
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment