我使用 doGet() 方法向 servlet 提交表单。我需要的是通过 doGet() 将 id 传递给 servlet 并在该方法中检索它。
到目前为止我尝试了什么:添加一个 id 作为查询字符串并在 doGet 中使用 request.getParameter()。我在 doPost() 及其工作中使用了相同的方法。
客户端代码
downloadPanel = new FormPanel();
downloadPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
downloadPanel.setMethod(FormPanel.METHOD_GET);
downloadPanel.setAction(GWT.getModuleBaseURL()+"downloadfile" + "?entityId="+ 101);
downloadPanel.submit();
服务器端 servlet
public class FileDownload extends HttpServlet {
private String entityId;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
entityId = request.getParameter("entityId");
entityId 为空。如何将 Id 传递给 doGet() 请求?至于在线查看示例,这应该可以正常工作,因为它适用于 doPost() 。谢谢,因为我很难过
浮云间
相关分类