首页 > 解决方案 > 如何获取 URL 参数?

问题描述

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

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

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

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

我怎样才能获得> id = 0001?

标签: javajsf

解决方案


要获得 id 你可以这样做

req.getParameter("id");


推荐阅读