Forms 使用java 6的HttpServletRequest和表单

Forms 使用java 6的HttpServletRequest和表单,forms,servlets,java-ee-6,Forms,Servlets,Java Ee 6,我用Java7编写了这段代码,它可以正常工作。 我现在正尝试使用Java6,这变得很奇怪:请求对象没有任何可见的参数,因此我无法访问随表单发送的信息 代码如下: <%@ page pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/j

我用Java7编写了这段代码,它可以正常工作。 我现在正尝试使用Java6,这变得很奇怪:请求对象没有任何可见的参数,因此我无法访问随表单发送的信息

代码如下:

    <%@ page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Thesaurus Builder</title>
    <link type="text/css" rel="stylesheet" href="<c:url value="/form.css"/>" />
</head>
<body>
    <form action="<c:url value='/' />" method="post" enctype="multipart/form-data"> <!-- accept-charset="UTF-8" -->
        <fieldset>
            <legend>Analyse de texte</legend>

            <label for="file">Fichier à analyser</label>
            <textarea rows="7" cols="100" name="file" id="file" ></textarea>
            <br />
            <br />

            <label for="encoding">Encodage</label>
            <input type="text" id="encoding" name="encoding" value="UTF-8" />
            <br />
            <br />

            <label for="skos">Choississez un thesaurus</label>
            <c:if test="${empty listThesaurus}">
                <input type="text" id="skos" name="skos" value="No thesaurus avalaible"  disabled = "disabled"/>
            </c:if>
            <c:if test="${not empty listThesaurus}">
                <select id="skos" name="skos" >
                    <c:forEach var="item" items="${listThesaurus}">
                        <option value= "<c:out value="${item.key}/${item.value}" />" ><c:out value="${item.key} - ${item.value}" /></option>
                    </c:forEach>
                </select>
            </c:if>
            <br />
            <br />

            <label for="model">Choississez un model (temp)</label>
            <c:if test="${empty listModel}">
                <input type="text" id="encoding" name="encoding" value="No model avalaible"  disabled = "disabled"/>
            </c:if>
            <c:if test="${not empty listModel}">
                <select id="model" name="model" >
                    <c:forEach var="item" items="${listModel}">
                        <option value= "<c:out value="${item.key}/${item.value}}" />" ><c:out value="${item.key} - ${item.value}" /></option>
                    </c:forEach>
                    <c:if test="${empty listModel}"></c:if>
                </select>
            </c:if>
            <br />
            <br />


            <br />
            <label for="debug">Mode Debug</label>
            <input type="checkbox" id="debug" name="debug"/>
            <br />
            <br />

            <input type="submit" value="Envoyer" class="sansLabel" />
            <br />                
        </fieldset>
    </form>

    <c:if test="${not empty param.debug }">
        <c:if test="${not empty debug }">
            <p class="debug"><c:forEach items="${debug}" var="e">${e}<br/></c:forEach></p>
        </c:if>
    </c:if>

    <c:if test="${not empty errors}">
        <p class="error"><c:forEach items="${errors}" var="e">${e}<br/></c:forEach></p>
    </c:if>

    <c:if test="${not empty tags}">
        <h3>Résultat Etude stockastique :</h3>

        <div id="tagCLoud">
        <h4>Tag Cloud </h4>
            <c:forEach items="${tags}" var="tag">
                <span style ="margin-right: 64px"><span class = "tags"  style = "font-size: ${tag.value[1]};"><c:out value = "${tag.key}"/></span>(${tag.value[0]})</span>
            </c:forEach>
        </div>
        <div id="coocurrence">
        <h4>Co-occurrence </h4>
            <c:forEach var = "i" begin="0" end="${ fn:length(coocurrence) -1}">
                <c:forEach var = "j" begin="0" end="${ fn:length(coocurrence[i]) -1}">
                <c:choose>
                    <c:when test="${j == 0}">
                        <c:out value="${coocurrence[i][j]} :"/><br>
                    </c:when>
                    <c:otherwise>
                    <span style ="margin-left: 30px">- <c:out value="${coocurrence[i][j]}"/></span><br>
                    </c:otherwise>
                </c:choose>
                </c:forEach>
                <br>
            </c:forEach>
        </div>
        <br>
        <br>
        <div id="concordance">
        <h4>Concordance </h4>
            <c:forEach var = "i" begin="0" end="${ fn:length(concordance) -1}">
                <c:forEach var = "j" begin="0" end="${ fn:length(concordance) -2}">
                <c:choose>
                    <c:when test="${j == 0}">
                        <c:out value="${concordance[i][j]} :"/><br>
                    </c:when>
                    <c:otherwise>
                    <span style ="margin-left: 30px">"<c:out value="${concordance[i][j]}"/>"</span><br>
                    </c:otherwise>
                </c:choose>
                </c:forEach>
                <br>
            </c:forEach>
        </div>
    </c:if>

    <c:if test="${not empty prettyOutput}">
        <h3>Résultat Etude Controlée :</h3>
        <table>
            <tr>
                <th>Concept</th>
                <th>Concept supérieur</th>
                <th>Concept(s) référent(s)</th>
                <th>Concept(s) reliés</th>
                <th>Valeur</th>
            </tr>
            <c:forEach items="${prettyOutput}" var="o">
            <tr>
                <td><c:out value="${o['node']}"/></td>
                <td><c:out value="${o['broader']}"/></td>
                <td><c:out value="${o['narrower']}"/></td>
                <td><c:out value="${o['related']}"/></td>
                <td><c:out value="${o['nRank']}"/></td>         
            </tr>
            </c:forEach>
        </table>
    </c:if>



</body>
</html>

在servlet中,f为null。

请参见此链接。我没看到那个。如果我的项目在j6中,为什么不将自己设置为j6?它不工作。我仍然有同样的问题。经过一些测试,我开始认为问题来自动态web模块,我必须从3.0更改为2.5。我会朝这个方向看,如果需要的话,创造一个新的主题。
package laetan.web.servlets;

import java.io.IOException;
import java.util.Enumeration;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import laetan.web.model.analyzer.TextAnalyzer;
import laetan.web.model.builder.FileLoader;
import laetan.web.model.builder.Vocabulary;

public class Analyzer extends HttpServlet {
    private static final long serialVersionUID = 1L;

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{


        FileLoader.getThesaurii(request,true);
        FileLoader.getModels(request,true);
        this.getServletContext().getRequestDispatcher( "/WEB-INF/input.jsp" ).forward( request, response );

    }
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{

        String f = request.getParameter("file");
        Vocabulary vocabulary = new Vocabulary(request,"load");
        @SuppressWarnings("unused")
        TextAnalyzer analyze = new TextAnalyzer(request, vocabulary);

        this.getServletContext().getRequestDispatcher( "/WEB-INF/input.jsp" ).forward( request, response );

    }


}