Question

I am using GWTP. There is a method to openURL as following:

public void openURL(int key){
     PlaceRequest request = new PlaceRequest(NameTokens.search).with("showData", "y");
     if(key==1){
         request.with("firstVariable","2154");
     }
     else if(key==2){
         request.with("secondVariable","4454");
     }
     String url =   Window.Location.createUrlBuilder().setHash(placeManager.buildHistoryToken(request)).buildString();
     Window.open(url, "_blank", null);
}

There is a button to call openURL(1), after clicking button it open a url in this form:

abc.com#search;showData=y

Clearly the above url missing the firstVariable param part.

The correct url should be

   abc.com#search;showData=y;firstVariable=2154

I don't know why GWTP didn't read the request.with("firstVariable","2154"); part as we expected.

Can you find out a solution?

Was it helpful?

Solution

request.with(param, value) returns new PlaceRequest, so

request = request.with("firstVariable","2154");

is what you need.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top