如何在JAVA springboot中获取值按钮

时间:2018-04-24 04:02:26

标签: java thymeleaf

如何在单击时在控制台中访问和打印table-row值?

我的HTML代码

<tbody>
<tr th:each="taskJob : ${theTaskSchJobList}" style="text-align: center">
    <td th:text="${taskJob.id}">Id</td>
    <td th:text="${taskJob.title}">Username</td>
    <td th:text="${taskJob.script}">Script</td>
    <td>
        <form th:action="@{RunJob}" method="POST"
              class="form-horizontal" id="RunScriptJob">
            <!--START Button-->
            <button type="submit" class="btn btn-default" th:object="${taskJob.script}"
                    th:value="${taskJob.script}" th:name="${taskJob.script}"
                    th:id="${taskJob.script}">
                <span class="glyphicon glyphicon-play"></span>
            </button>

            <!--RESET Button-->
            <button type="submit" class="btn btn-default">
                <span class="glyphicon glyphicon-stop"></span>
            </button>
        </form>

    </td>
</tr>
</tbody>

我的控制器 - 它返回null,

@RequestMapping(value = "/RunJob", method = RequestMethod.POST)
public String theJob(HttpServletRequest req) {

    String script = req.getParameter("taskJob.script");

    System.out.println("#######>>>>>" + script);

    return "redirect:/cronJob";

}

我的图表diagram table

0 个答案:

没有答案