1

I'm writing an app using GWT and Java Google App Engine. When I launch a page of the app using devmode, I see a URL that has the suffix "?gwt.codesvr=127.0.0.1:9997". Without that suffix, devmode does not seem to work; therefore I assume it must be there when using devmode (to tell the devmode plugin the address of the server talking to the devmode UI, I presume).

In my app I sometimes either use a redirect on the server side to one of my own pages or emit an HTML page that contains a link to one of my own pages. As I want to browse the app the way a user would, in my URL generation code I look for the parameter "gwt.codesvr", get its value, and then put that suffix that back onto the URL as the query string; that is, I copy the query string. I have checked in the generated HTML that this is doing what I expect:

<form class="float-right" action="/foo/id123?gwt.codesvr=127.0.0.1:9997" method="GET" >
<input class="color-red" type=submit value="Get Started" />
</form>

Such links/redirects are intended to move the user from page to page and I thought generating such links would allow me to browse do the same as the user but in devmode; however, it does not seem to be working. In particular, when I click on the link to go to the next page, the query string does not show up in the URL in the browser. That is, the URL in the location bar of Chrome is:

http://127.0.0.1:8888/foo/id123?

I don't really know how it is possible to click on a link and have the browser go to the same url but minus the query string (but not missing the "?").

In my app, I am generating the link in Intro.jsp which should forward to /foo/id123?gwt.codesvr=127.0.0.1:9997. My app.yaml headers section says something similar to this:

handlers:

- url: /Intro
  jsp: Intro.jsp

# the internal rpc service
- url: /waga/rpc
  name: WagaServiceImpl
  servlet: com.waga.server.WagaServiceImpl
  login: required

- url: /foo/*
  name: FooServlet
  servlet: com.waga.server.FooServlet
  login: required
4

1 回答 1

0

您的问题与在操作 URL 中传递参数有关。这个问题已经在这里回答了。似乎无法更改操作 URL 中的查询字符串。一种替代方法是使用隐藏输入来传递参数。另一种方法是使用超链接。

<a href="/foo/id123?gwt.codesvr=127.0.0.1:9997">Link</a>
于 2012-04-13T12:16:50.070 回答