【发布时间】:2017-10-26 03:24:28
【问题描述】:
我想在我的表单面板上传递一个字符串参数。是否可以在 GWT 表单面板上添加字符串参数数据?
我的 servlet 代码将使用 post 接收传递的字符串参数,我无法在链接中包含参数,因为它有大量数据
这是我的 servlet 代码:
public void doPost(HttpServletRequest request, HttpServletResponse response) {
String printMode = request.getParameter("printMode");
String nodeNm = ConfigConstants.PRINTER.getValue();
String outputLogPath=SrchSvcImpl.cnfg.readValCnfg(nodeNm, ConfigConstants.OUTPUT_ERROR_LOG.getValue());
if(printMode.equalsIgnoreCase("single_print")) {
String role = request.getParameter("role");
String itemsToPrint = request.getParameter("itemsToPrint");
//do something else..
}
}
【问题讨论】:
-
我设法使用表单输入框解决了这个问题,将字符串放入其中并禁用它们。然后 doPost 方法将遍历这些项目,并在从中获取正确的值之前检查它们的“id”。
-
使用Hidden 小部件。它创建
<input type='hidden'>元素。 -
@Adam 你应该把它作为答案;这是正确的答案。
-
@ThomasBroyer 我按照你的建议做了。希望它会更容易找到答案。