2013-03-05 32 views
1

使用spring MVC的Im。如果你打算在多个方法中处理相同的路径Spring

我的控制器是:

@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是:

<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 

当我点击批准其发送到成功页面。我想用刷新将它带到上一页。 任何人都可以解决我的问题。

+1

我不明白你的问题。 – tbsalling 2013-03-05 07:02:58

+0

Approve当我尝试批准其重定向到另一个成功页面的值,但它不会返回到上一页。 – 2013-03-05 07:05:17

+0

护送和手机号码的美好时光。 Mabye着眼于定义模型和查看重定向。 ModelAndView nextView = new ModselAndView(“redirect:pendingEscortdetails”); – 2013-03-05 07:05:42

回答

0

使用

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

而不是

return "pendingescort"; 
+0

其重定向本页http:// localhost:8080/efmfm-app/approval/pendingescort?mobileno = 123456789实际是http:// localhost:8080/efmfm-app/efmfm/main/approval/pendingescort而且在jsp im发送请求为 2013-03-05 08:24:52

+0

已编辑的答案。但pendingescort视图如何解析为不同的jsp(您在代码中提到过)。 – nav0611 2013-03-05 09:06:25

+0

您能否提供以上views.xml以获得更多解释\ – nav0611 2013-03-05 09:08:55

0

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

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


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

+0

@BashaGhouse:如果我的回答帮助你,请标记为正确。 – Anubhab 2013-03-05 09:10:34

相关问题