ср, 17 февр. 2021 г. в 20:05, Christopher Schultz
<ch...@christopherschultz.net>:
>
> Konstantin,
>
> [...]
>
> Without being able to rely on form-data ordering, the only way to "know"
> which question was asked first, second, etc. would be to either put a
> hidden form element on the page describing the question-order (back to
> the server) or to have individual hidden elements for each question
> specifying the order. Something like this:
>
>    <input type="hidden" name="question_3762_order" value="1" />
>    <input type="hidden" name="question_213_order" value="2" />
>    ...

An alternative solution can be to include both question id and order
in the field name. E.g.

<input name="answer_1_3762" placeholder="Answer for Q3762">
<input name="answer_2_213" placeholder="Answer for Q213">

Well, your use case is a valid one.

BTW, for the same grounds for forms submitted with mime type of
"multipart/form-data"
the HttpServletRequest.getParts() method could return an ordered
collection (a List).
As of now, the API is specified to return a Collection<Part> [1].

[1] 
https://javaee.github.io/javaee-spec/javadocs/javax/servlet/http/HttpServletRequest.html#getParts--

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to