Java 验证后提交时非常随机的空jsp表单数据

Java 验证后提交时非常随机的空jsp表单数据,java,forms,jsp,tomcat7,servlet-3.0,Java,Forms,Jsp,Tomcat7,Servlet 3.0,我们有一个jsp(2.2)/jstl(2.1)表单,它提交给Tomcat7服务器上的Javaservlet(3.0)。随机地,间歇性地,我们将获得一个提交到servlet的文件,其中所有http请求参数值都为null。我们的表单中有一些字段是预先填充的,所以我们希望至少那些字段是可检索的,但它们在serlvet处也是空的。我们收到的几乎所有表单提交都包含表单数据并已成功处理。这是每提交这么多次中就有一次的http请求参数集是完全空的,我无法理解也无法重现。没有涉及文件上传,数据通过post提交。

我们有一个jsp(2.2)/jstl(2.1)表单,它提交给Tomcat7服务器上的Javaservlet(3.0)。随机地,间歇性地,我们将获得一个提交到servlet的文件,其中所有http请求参数值都为null。我们的表单中有一些字段是预先填充的,所以我们希望至少那些字段是可检索的,但它们在serlvet处也是空的。我们收到的几乎所有表单提交都包含表单数据并已成功处理。这是每提交这么多次中就有一次的http请求参数集是完全空的,我无法理解也无法重现。没有涉及文件上传,数据通过post提交。我们验证客户端和服务器端。我到处寻找表单数据可以为空但没有成功的原因。有什么想法吗

1) 没有文件上传 2) 所有字段都有“name=” 3) 方法是post 4) 数据在提交之前经过验证 5) 为数据库实体管理实现一个过滤器

部分jsp表单:

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
response.setHeader("Cache-Control", "no-cache");//Forces caches to obtain a     new copy of the page from the origin server
response.setHeader("Cache-Control", "no-store");//Directs caches not to store the page under any circumstance
response.setDateHeader("Expires", 0);//Causes the proxy cache to see the page as "stale"
response.setHeader("Pragma", "no-cache");//HTTP 1.0 backward enter code here
%>
<!DOCTYPE html>
<!--head/body stuff -->
<form id="app_form" name="app_form" action="process" method="post" novalidate="novalidate" accept-charset="ISO-8859-1">

<!-- general form fields using html/jstl -->

<button type="submit" id="submit_application" name="submit_application" class="submit application submitbtn" title="I'm finished and want to submit my completed application.">SUBMIT APPLICATION</button>

</form>
部分java servlet:

public class ProcessApplicationFormServlet extends BaseServlet {

private static Logger log = Logger.getLogger(ProcessApplicationFormServlet.class);
private static final long serialVersionUID = 1L;
Application_Domestic appdata = null;
Domestic_user currentUser = null;
String sessID = null;
String program = null;
String type = null;

@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {
    try {
        //values from form
        appdata.setTitle(maxLength(req.getParameter("title"),25));
        appdata.setFirst(maxLength(req.getParameter("first"),30));
        appdata.setMiddle(maxLength(req.getParameter("middle"),30));
        appdata.setLast(maxLength(req.getParameter("last"),57));
        appdata.setSuffix(maxLength(req.getParameter("suffix"),25));                        
        appdata.setEmail_Address(maxLength(req.getParameter("trueemail"),50)); 
        etc...
        process data 
    }
}
@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);
}

这些只是处理提交/http请求的部分。如果有其他重要的编码注意事项,我需要显示,请让我知道。请记住,只有1-2%的表单提交中包含空的httpServletRequest数据。这段代码已经过测试并正常工作。当用户提交表单(在验证所有数据之前不能提交表单)并且表单到达servlet时,它带有一个空数据集,其中每个参数都为null,我似乎无法重现这种场景

更新:在处理之前,我更新了servlet以记录请求参数(通过枚举)。我注意到,对于那些无法成功提交表单的申请人,http请求参数丢失了超过一半的表单数据。缺少的字段包括典型名称、地址、城市、州等。另一个更新:查看堆栈跟踪显示,提交表单时,它将转到doGet而不是doPost。表单的方法被明确设置为post,99.5%的应用程序正在这样做。我想知道的是,在什么样的情况下,剩下的.5%会作为get而不是post提交?
public class ProcessApplicationFormServlet extends BaseServlet {

private static Logger log = Logger.getLogger(ProcessApplicationFormServlet.class);
private static final long serialVersionUID = 1L;
Application_Domestic appdata = null;
Domestic_user currentUser = null;
String sessID = null;
String program = null;
String type = null;

@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {
    try {
        //values from form
        appdata.setTitle(maxLength(req.getParameter("title"),25));
        appdata.setFirst(maxLength(req.getParameter("first"),30));
        appdata.setMiddle(maxLength(req.getParameter("middle"),30));
        appdata.setLast(maxLength(req.getParameter("last"),57));
        appdata.setSuffix(maxLength(req.getParameter("suffix"),25));                        
        appdata.setEmail_Address(maxLength(req.getParameter("trueemail"),50)); 
        etc...
        process data 
    }
}
@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);
}