V
V
Viktoria Smirnova2018-08-11 21:51:52
Java
Viktoria Smirnova, 2018-08-11 21:51:52

Input not passing value correctly?

I'm sorting through a selection from the database,

JSTL :forEach
I immediately register this case in Input, to send it to the server after the user clicks, but the problem is that Input transmits only the first value of the database selection, and this is not correct, what could be the matter? Or Input as a whole is not suitable for this? And immediately the second question LocalDate can be sent in this way or will it be necessary to parse?

On the client:
<code><form action="Servlet2" method="post">
    <c:forEach items="${times}" var="listtime">
    <input type="text" name="activeClient" value="<c:out value="${active}"/>" hidden/>
    <input type="text" name="timeClient" value="<c:out value="${listtime.tt}"/>" readonly/>
    <input type="submit" value="ok" /><br/>
        <%--Если придет null с БД вопрос решаеться здесь--%>
        <c:if test="${empty listtime.tt}">
            <p>Yes, Currency ArrayList is empty" </p>
        </c:if>
</c:forEach>
</form></code>


On server:
<code>protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String activeClient = request.getParameter("activeClient");
        String timeClient = request.getParameter("timeClient");
        System.out.println(activeClient);
        System.out.println(timeClient);
        }</code>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktoria Smirnova, 2018-08-11
@Vika7

Oh, sorry, I found the answer myself, forEach had to be deduced for the form. I hope someone can come across these, to save time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question