Hi guys,
I have searched the forum and couldn't find the solution. Here is my
code.
public class Getter {
private String url = "php/Main.php"; //fix url never
changes
private RequestBuilder builder = null;
private String result = null;
public Getter() {
builder = new RequestBuilder(RequestBuilder.POST,
URL.encode(url));
}
public String getData(int id, final String section){
String param = "nId=";
param += Integer.toString(id);
param +="&";
param +="sectionName=";
param += section;
builder.setHeader("Content-Type", "application/x-www-form-
urlencoded");
try {
builder.sendRequest(param,new RequestCallback(){
public void onError(Request request,
Throwable exception) {
calxx("error");
}
public void onResponseReceived(Request
request, Response
response) {
calxx(response.getText());
Window.alert("-"+response.getText());
TemoStorage.temp =
response.getText();
}
});
} catch (RequestException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
GWT.log(TemoStorage.temp, null);
return TemoStorage.temp;
}
private void calxx(String kk){
result = kk;
}
}
TemoStorage.temp is static string field.
now, when I call the method getData from the other class. I get the
window alert displaying the apropriat server message. But this method
return null. GWT log also says null. How do I return apropriat
"server message" with this method.
Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---