@P_Alexander
First head

Почему в контроллере получаю данные с двух форм?

Добрый вечер, есть две формы, у каждой формы свой submit замапленый по айдишнику формы, при тыке на любой из них получаю в контроллере данные из двух форм, почему?
контроллер
@RequestMapping(value = "/ceo", method = RequestMethod.POST)
    public String postCeo(@ModelAttribute("rcf") RemoveCustomerForm rcf, @ModelAttribute("ctm") CustomerTransferModel ctm, Model model) {
        logger.debug("RemoveCustomerForm -- " + rcf.toString()); //--- тут будут данные из одной формы
        logger.debug("CustomerTransferModel -- " + ctm.toString()); // --- и тут будут данные из второй формы за раз

        model.addAttribute("customers", prepareCustomer());
        model.addAttribute("searchPassportForm", searchPassportForm);
        return "ceo";
    }

страничка
<th:block th:each="customer: ${customers}">
                <div>
                    <span th:text="${customer.name}"></span>
                    <span th:text="${customer.email}"></span>
                    <span><a th:href="@{/ceo/customer/{login}(login=${customer.login})}" th:text="${customer.login}"></a></span>
                    <span th:text="${customer.role.role}"></span>
                    <span th:text="${customer.statusAccount}"></span>
                    <form th:id="${customer.statusAccount} + '' + ${customer.id}" th:action="@{/ceo}"  method="post">
                        <input type="hidden" th:form="${customer.statusAccount} + '' + ${customer.id}" name="login" th:value="${customer.login}">
                        <input type="hidden" th:form="${customer.statusAccount} + '' + ${customer.id}" name="statusAccount" th:value="${customer.statusAccount}">
                        <input type="hidden" th:form="${customer.statusAccount} + '' + ${customer.id}" name="action" value="block">
                        <input type="submit" th:form="${customer.statusAccount} + '' + ${customer.id}" value="Block">
                    </form>
                    <form th:id="${customer.name}" th:action="@{/ceo2}" method="post">
                        <input type="hidden" th:form="${customer.name}" name="login" th:value="${customer.login}">
                        <input type="hidden" th:form="${customer.name}" name="action" value="remove">
                        <input type="submit" th:form="${customer.name}" value="Remove">
                    </form>
                </div>
            </th:block>

Любая помощь спасибо.
  • Вопрос задан
  • 55 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
Bell Integrator Ульяновск
До 400 000 ₽
Bell Integrator Хабаровск
До 400 000 ₽
Bell Integrator Ижевск
До 400 000 ₽
19 апр. 2024, в 18:38
1500 руб./в час
19 апр. 2024, в 18:36
1500 руб./за проект
19 апр. 2024, в 18:36
30000 руб./за проект