Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
百里香-我能';t使用链接th:href将两个值从HTML传递给控制器_Html_Spring_Spring Mvc_Spring Security_Thymeleaf - Fatal编程技术网

百里香-我能';t使用链接th:href将两个值从HTML传递给控制器

百里香-我能';t使用链接th:href将两个值从HTML传递给控制器,html,spring,spring-mvc,spring-security,thymeleaf,Html,Spring,Spring Mvc,Spring Security,Thymeleaf,我用的是百里香和弹簧靴。 我的html中有一个使用thymeleaf的链接: <a th:href="@{/fleetcompany/workorders/proposals/selected/{id}(id=${proposal.bidID})/{id2}(id2=${proposal.workID})}">SELECT</a> 这是我的MVC控制器: @RequestMapping(value={"/workorders/proposals/selected/{b

我用的是百里香和弹簧靴。 我的html中有一个使用thymeleaf的链接:

 <a th:href="@{/fleetcompany/workorders/proposals/selected/{id}(id=${proposal.bidID})/{id2}(id2=${proposal.workID})}">SELECT</a>
这是我的MVC控制器:

@RequestMapping(value={"/workorders/proposals/selected/{bidID}/{woNumber}"}, method = RequestMethod.GET)
public String selectProposal(Model model,
        final RedirectAttributes redirectAttributes,
        @PathVariable("bidID") Long bidID,
        @PathVariable("woNumber") Long woNumber){

    String selected = "Selected";
    String notSelected = "Not Selected";
    String orderStatus = "Pending";
    bidServiceInterface.updateSelectedBidStatus(selected, bidID);
    bidServiceInterface.updateNotSelectedBidStatus(notSelected, woNumber);
    woServiceInterface.updateWorkOrderStatus(orderStatus, woNumber);
    return "redirect:/fleetcompany/workorders";
}

我知道我所有的数据类型都是正确的,因为当我交换两个ID时,它工作了,但当我同时使用它们时,它就不工作了。

我解决了这个问题。我不知道我只能用一个初始值。像这样

<a th:href="@{/fleetcompany/workorders/proposals/selected/{id}/{id2}(id=${proposal.‌​bidID}, id2=${proposal.woNumber})}">SELECT</a>.

当您收到错误时,它使用的实际url是什么?我还想知道,当您选择/1234/1234时,path变量是否正在转换为1234/1234,因此,它无法转换为long。你能试试/selected/1234/workorder/1234吗?只是在一个示例项目中尝试了一下,让两个路径变量彼此相邻对我来说很好。让我觉得应该有一些数字。你能发布它的URL吗?@blur0224我解决了。我不知道我只能用一个初始值。像这样。莱斯特:你可以把你所做的写下来作为回答,然后接受它,这样将来的人也可以学习。
<a th:href="@{/fleetcompany/workorders/proposals/selected/{id}/{id2}(id=${proposal.‌​bidID}, id2=${proposal.woNumber})}">SELECT</a>.