Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Forms 处理应用程序的表单数据/x-www-form-urlencoded contentType_Forms_Jsp_Servlets_Content Type - Fatal编程技术网

Forms 处理应用程序的表单数据/x-www-form-urlencoded contentType

Forms 处理应用程序的表单数据/x-www-form-urlencoded contentType,forms,jsp,servlets,content-type,Forms,Jsp,Servlets,Content Type,我在jsp页面中有一个textarea,它的内容在Servlet中处理。 我认为contentType是多部分的,所以我想我应该使用getFormField()和getString()方法来提取值,但这会引发一个异常 the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/x-www-form-urlencoded 当我使用re

我在jsp页面中有一个
textarea
,它的内容在Servlet中处理。 我认为contentType是多部分的,所以我想我应该使用
getFormField()
getString()
方法来提取值,但这会引发一个异常

the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/x-www-form-urlencoded

当我使用
request.getParameter(“textAreaID”)
时,它总是空的。我如何处理这种情况?任何帮助都将不胜感激。请让我知道,如果问题没有在表决前以适当的方式提出。提前感谢。

如果要提取多个字段的值,可以使用getParameterNames()方法

       Enumeration paramNames = request.getParameterNames();
       while(paramNames.hasMoreElements())
           {
              String parameter = (String) paramNames.nextElement();
              String parameterValue = (String) request.getParameter(parameter);
              System.out.println("*****" + parameter + " - " + parameterValue);
           }