HTML - THYMELEAF - pass parameter

1

I created a parameter in the ProcedureCallerRepository and ProcedureCallerRepositoryImpl so far everything ok my error is in html and I do not know where I'm wrong (sorry if it's a silly thing though I'm still learning)

but the part I need is this:

<form method="GET" th:action="@{/acompanhamentoprimeiropedido}">
    <label>Busca</label>
     <input class="input-sm form-control" type="text" name="parametroBuscaPrimeiroPedido" />

My parameter is attached to the first request and the error that appears on the screen is: There was an unexpected error (type = Bad Request, status = 400). Required String parameter 'parametroBuscaPrimeiroPedido' is not present

Could someone give me a light on how to pass the parameter using thymeleaf here in html?

follow my HTML code:

<!DOCTYPE html>

Tracking First Order                                            Request Date:                                                            Up until                                                          Search          

    <div class="col-xs-12 col-md-12">
        <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
            <th:block th:each="diaPedido : ${listaDias}">
                <div class="panel panel-info">
                    <div class="panel-heading panel-heading-diaPedido" role="tab" th:id="'heading-' + ${diaPedido}">
                        <h4 class="panel-title text-left" role="button" data-toggle="collapse" data-parent="#accordion" th:href="'#collapse-' + ${diaPedido}" aria-expanded="false" aria-controls="collapseOne">
                            <a th:text="${#strings.substring(diaPedido,8,10)+'/'+#strings.substring(diaPedido,5,7)+'/'+#strings.substring(diaPedido,0,4)}"> </a> <i class="fas fa-caret-down pull-right"></i>
                        </h4>
                    </div>
                    <div th:id="'collapse-' + ${diaPedido}" class="panel-collapse collapse" role="tabpanel" th:attr="aria-labelledby='heading-' + ${diaPedido}">
                        <div class="list-group">
                            <div class="table-responsive display">
                                <table class="table table-bordered table-striped">
                                    <thead>
                                        <tr style="font-size: 12px">
                                            <th class="text-center col-md-2">Hora</th>
                                            <th class="text-center col-md-2">Master</th>
                                            <th class="text-center col-md-1 hidden-xs">Pedido</th>
                                            <th class="text-center col-md-4">Fantasia</th>
                                            <th class="text-center col-md-2">Contato</th>
                                            <th class="text-center col-md-1 hidden-xs">Telefone</th>
                                            <th class="text-center col-md-1 hidden-xs">Faturado</th>
                                            <th class="text-center col-md-1 hidden-xs">Embarcado</th>
                                            <th class="text-center col-md-1 hidden-xs">Previsão</th>
                                            <th class="text-center col-md-1">Entrega</th>
                                            <th class="text-center col-md-1"></th>
                                            <th class="text-center col-md-1"></th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <th:block th:each="primeiroPedido : ${listaPrimeiroPedido}">
                                            <tr th:if="${#strings.replace(primeiroPedido[6],'-','') == #strings.replace(diaPedido,'-','')}">
                                                <td th:text="${#strings.isEmpty(primeiroPedido[6])  ? primeiroPedido[7] : primeiroPedido[7]}"></td>
                                                <td th:text="${primeiroPedido[0]}"></td>
                                                <td class="hidden-xs" th:text="${primeiroPedido[5]}"></td>
                                                <td th:text="${primeiroPedido[2]}"></td>
                                                <td th:text="${primeiroPedido[3]} "></td>
                                                <td class="hidden-xs" th:text="${#strings.replace(primeiroPedido[4],' ','')}"></td>
                                                <td class="hidden-xs" th:text="${#strings.isEmpty(primeiroPedido[8])  ? '' : #dates.format(primeiroPedido[8], 'dd/MM/yyyy')+' '+primeiroPedido[9]} "></td>
                                                <td class="hidden-xs" th:text="${#strings.isEmpty(primeiroPedido[10])  ? '' : #dates.format(primeiroPedido[10], 'dd/MM/yyyy')+' '+primeiroPedido[11]}"></td>
                                                <td class="hidden-xs" th:text="${#dates.format(primeiroPedido[12], 'dd/MM/yyyy')}"></td>
                                                <td th:text="${#strings.isEmpty(primeiroPedido[14])  ? '' : #dates.format(primeiroPedido[13], 'dd/MM')}"></td>
                                                <td class="text-center"><span class="label" th:classappend="${#strings.isEmpty(primeiroPedido[17])  ? 'label-danger' : 'label-success'}"> </span></td>
                                                <td class="text-center"><a class="btn btn-link btn-xs"> <span data-toggle="modal" data-target="#exampleModal" class="glyphicon glyphicon-file" th:attr="data-object-id=${primeiroPedido[5]}" th:onclick="'defineCodigoPrimeiroPedido(\'' + ${primeiroPedido[5]} + '\');'"> </span>
                                                </a></td>
                                            </tr>
                                        </th:block>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </th:block>
        </div>
    </div>
    <!--   </form>  -->
    <a class="btn btn-voltar" href="home" role="button botao">Voltar</a>
</div>

    
asked by anonymous 28.08.2018 / 14:47

1 answer

2

Here's my answer:

<form method="GET" th:action="@{/acompanhamentoprimeiropedido}">
        <input class="form-control" name="parametroBuscaPrimeiroPedido" />
        <button type="submit" class="btn btn-info" style="width: 100%;">
            <i class="glyphicon glyphicon-search"></i>
        </button>
</form>

the th: action a class of thymeleaf has to stay inside the form and I added a button to submit the name="parametroBuscaPrimeiro Request".

Within this parameter I would call data coming from a procedure, in my case I just wanted to display the information.

    
28.08.2018 / 18:08