模型视图控制器——如果你打算在多个方法中处理相同的路径



我使用spring MVC。

My Controller is:

@RequestMapping(value = "/approval/pendingescort", method = RequestMethod.GET)
public String getPendingEscort(Model model) {
    log.debug("Received request to show Pending Escorts");
// Retrieve all pending escort details by delegating the call to Servicelayer
    List<EscortRegistration> pendingEscortdetails = approvalService.getAllPendingEscort();
// Attach zones to the Model
     model.addAttribute("pendingEscortdetails", pendingEscortdetails);
// This will resolve to /WEB-INF/jsp/pendingescort.jsp
    return "pendingescort";
}
@RequestMapping(value = "/approval/pendingescort/success", method = RequestMethod.GET)
public String addEscort(@RequestParam(value="mobileno", required=true) String mobileno,Model model) {
    log.debug("Received request to Accept Escort Request");
        // Call ZonedetailsService to do the actual Updating
        approvalService.approveEscortRequest(mobileno);
        // Add mobile reference to Model
        model.addAttribute("mobileno", mobileno);
        // This will resolve to /WEB-INF/jsp/addedescortpage.jsp
        return "pendingescort";
}

和我的JSP Is:

<tbody>
                    <c:forEach items="${pendingEscortdetails}" var="escort">
                    <c:url var="editUrl" value="/efmfm/main/approval/pendingescort/success?mobileno=${escort.mobilenumber}" />
                    <c:url var="deleteUrl" value="/efmfm/main/approval/pendingescort/delete?mobileno=${escort.mobilenumber}" />
                    <tr>
                    <td><c:out value="${escort.mobilenumber}" /></td>
                    <td><c:out value="${escort.imei}" /></td>
                <td>    <a href="${editUrl}" class="approv">Approve</a> 
                    <!--  <td>Approve</td> -->
                    <a href="${deleteUrl}" class="approv">Reject</a>
                    </td>
                    </tr>
                    </c:forEach>
                </tbody

,当我单击以批准其发送到成功页面时。我想用刷新把它带到前一页。有谁能解决我的问题吗?

use

return "redirect:../../../approval/pendingescort";

代替

return "pendingescort";

第一:我猜你需要使用"../.."

return "redirect:../../../approval/pendingescort";


还有一个疑问。你在用瓷砖吗?

最新更新