2013-08-21 101 views
0
@RequestMapping("/toTicketRuleSetting/{ticketTypeId}") 
public String goToAssistSecretary(@PathVariable("ticketTypeId") long ticketTypeId, ModelMap model) { 
    model.put("ticketTypeId", ticketTypeId); 
    model.put("tabId", 0); 
    return "backend/basic/ticketRuleSetting"; 
} 

在spring mvc中,tabId在模型中會返回jsp頁面, 我想通過javascript在我的jsp頁面中獲取tabId,我該怎麼辦? 這裏是我的jsp頁面中的javascript代碼:如何通過javascript在jsp中從服務器獲取屬性?

window.onload = function(){ 
    <c:set var="tabId" value="${tabId}"/> 
    <c:if test = "{tabId.value==5}"> 
     $("#tabs").tabs("option", "active", 5); 
    </c:if > 

};

請幫幫我!

回答

0

嘗試在方法的參數使用的型號,這裏是代碼:

@RequestMapping("/toTicketRuleSetting/{ticketTypeId}") 
public String goToAssistSecretary(@PathVariable("ticketTypeId") long ticketTypeId, Model model) { 
    model.addAttribute("ticketTypeId", ticketTypeId); 
    model.addAttribute("tabId", 0); 
    return "backend/basic/ticketRuleSetting"; 
} 

然後,把它在你的函數像你這樣。 CCMIIW :)

相關問題