answered
2020-09-07 18:40:28 +0800
cor3000 5868 ● 2 ● 7
It's sad to hear you spend 3 days on this.
By default a request to a path without a trailing "/" will be redirected to a path with a trailing "/" this redirect (302) happens via GET without re-sending the original POST parameters (common surprise).
Described in Servlet Spec 3.1 section 10.10:
- A request URI of "/foo" will be
redirected to a URI of "/foo/" -> (means 302 losing POST parameters)
- A request URI of "/foo/" will be
returned as "/foo/index.html" -> (or
index.zul
as configured in your web.xml)
You can also observe th redirect directly in the browsers developer tools.

The original request to the url .../myapp
contains the post parameters. The redirect to .../myapp/
doesn't.
https://stackoverflow.com/questions/46582/response-redirect-with-post-instead-of-get
That's just how a servlet container naturally behaves according to the specification, when relying on the built in welcome-file mechanism.
ZK simply won't receive the POST-parameters if they are not contained in the request.
There are ways around this... the most direct one you already found... avoid the automatic redirect by specifying the zul file directly. Or what you didn't try ... appending the trainling "/" manually -> ../myapp/
avoids the redirect as well.
You can also add a rule to your nginx or apache-httpd to append the trailing "/" before contacting the servlet server. So you can have nicer urls (if that's a requirement). Or you can add a custom servlet or filter to do this inside the application server. Just be creative.