如何获得 URL 参数?

How can I obtain a URL parameter?

我一直在尝试获取id参数:

http:///localhost/client/edit.xhtml?id=0001

我已经尝试使用下一个代码块通过 HttpServletRequest 获取参数,但我获取了 > id = 1

HttpServletRequest req = (HttpServletRequest) externalContext.getRequest();
String urlParams = req.getQueryString();

如何获取>id=0001?

要获取 ID,您可以这样做

req.getParameter("id");