Request builder is behaving exactly as expected here ... You should  
read:

http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/faca1575f306ba0f/3be719c021aa19bd?pli=1

-jason

On Dec 14, 2008, at 12:32 AM, dhaval wrote:

>
> 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 Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to