java - 如何获取 URL 参数?
问题描述
我一直在尝试获取 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");
推荐阅读
- angular - NX - 带有 Storybook 和单独导出组件的 UI 库
- android - 导航返回时的 RecyclerView(导航组件)
- javascript - 如何使用 JavaScript 通过电子邮件发送发票?
- reactjs - 我在功能组件中使用了 useLazyQuery,但我需要在类组件中使用相同的。我该怎么做?
- javascript - 修改日期时出现问题(修改错误)
- python - NumPy 使用 reshape 函数重塑数组
- python - 在 Python 中自定义集合交集
- arrays - 你如何比较两个在Powershell中都有多个属性和对象的数组
- android - 从 Flutter android MainActivity 启动新的外部 Activity
- php - Str_replace 用 php 中的数据库插入标题