Hello Juan in this link http://www.gwtapps.com/ you have the source code you are testing.
Greetings. 2009/12/23 Juan M.M.M. <[email protected]> > Thank you very much. You got the answer! > > >> "../movies.txt" > > Happy Christmas! > > On 22 dic, 21:14, Sripathi Krishnan <[email protected]> > wrote: > > The URL you are trying to access is wrong... > > > > Assuming you module is named hangman, this line > > final RequestBuilder requestBuilder = new RequestBuilder( > > RequestBuilder.POST, "movies.txt" ); > > > > makes a request tohttp://myserver.com/mywar/hangman/movies.txt, whereas > > you want it to behttp://myserver.com/mywar/movies.txt > > > > Try using "../movies.txt", or use GWT.getHostPageBaseURL() .. > > > > --Sri > > > > 2009/12/22 Juan M.M.M. <[email protected]> > > > > > Hi! > > > > > I'm doing an example that I found ina book about GWT. It's the typical > > > example of the hangman. I'm using Eclipse and GWT 2.0. This is my > > > code: > > > > > public class AhorGwt implements EntryPoint { > > > > > private FlowPanel letters = new FlowPanel(); > > > private Label wordLabel = new Label(); > > > private Image image = new Image(); > > > > > private final int MAX_GUESSES = 6; > > > private int misses; > > > private String[] words; > > > private String word; > > > private char[] visibleWord; > > > > > @Override > > > public void onModuleLoad() { > > > //create interface > > > RootPanel ahorcado = RootPanel.get("ahorcado"); > > > ahorcado.add(letters); > > > ahorcado.add(image); > > > ahorcado.add(wordLabel); > > > > > //load words > > > final RequestBuilder requestBuilder = new RequestBuilder > > > ( RequestBuilder.POST, "movies.txt" ); > > > try { > > > requestBuilder.sendRequest( null, new > > > RequestCallback(){ > > > > > public void onError(Request request, > > > Throwable exception) { > > > GWT.log( "failed getting movie > > > list", exception ); > > > } > > > > > public void onResponseReceived(Request > > > request, Response response) > > > { > > > words = > > > response.getText().split("\n"); > > > GWT.log(words[2], null); > > > startGame(); > > > }} ); > > > } catch (RequestException e) { > > > GWT.log( "failed getting movie list", e ); > > > } > > > wordLabel.setStyleName("word"); > > > } > > > // ... > > > } > > > > > My movies.txt file is under /war/ file next to my index.html. Ok, once > > > I get the supossed text file into 'words' variable I do a 'GWT.log > > > (words[2], null);' in the console developent mode of eclipse I get > > > this "HTTP Status 404 - Status report". As you can see, the file > > > movies.txt hasn't been loaded. Instead of this, the program has red a > > > kind of default text/html file. I don't know if the problem is in the > > > location of the file or If I'm using a wrong method to read files on > > > the client side. > > > > > Thanks, > > > > > Juanma > > > > > -- > > > > > 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]<google-web-toolkit%[email protected]> > <google-web-toolkit%[email protected]<google-web-toolkit%[email protected]> > > > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/google-web-toolkit?hl=en. > > -- > > 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]<google-web-toolkit%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > > > -- 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.
