在JSTL / JSP中选择返回null到servlet

时间:2016-03-14 19:39:49

标签: java jsp servlets jstl

我正在尝试在JSP页面中获取所选项目的值,当我在本地尝试它时,它可以工作!但是一旦我发布它,它就会停止工作,因为它总是为参数

返回“null”值

JSP / JSTL代码:

    <form action ="SelectedEntity" method ="get">
<label>Please select one of the following entities: </label>
<select name="Entity">
    <c:forEach var = "entity" items ="${entities}">
        <option ><c:out value="${entity}"/></option>
    </c:forEach>
    <input type = "submit" name = "submit" id = "submit" value ="Go">
</select>

</form>

这是servlet:

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

        String entity = request.getParameter("Entity");

这总是返回null ..有人可以帮我吗?

0 个答案:

没有答案