2013-03-08 55 views

回答

0

添加到您的jsp:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 

然後添加以下您的輸入標籤

<form:input type="text" path="member_variable_name"/> 

希望這回答了你的查詢.. 見this

+1

老兄我使用的是spring:form的輸入標籤。不是正常的輸入標籤。值不是form:input標籤的有效屬性。 – Rajasekhar 2013-03-08 11:53:26

+0

哦,我的壞..看編輯 – Anubhab 2013-03-08 11:59:35

+0

你現在明白了。但我想動態地在JSP中設置路徑值。 – Rajasekhar 2013-03-08 12:36:37

0

編輯你的MVC控制器方法使用@ModelAttribute(我希望你使用註釋)

@RequestMapping("/somepath/foo/do") 
public String someHandlerMethod(
    @ModelAttribute("commandObject") CommandObject commandObject, 
    Model model, 
    BindingResult result) { 

    commandObject.setSomeValue("sample"); //Set value in command object 

    ...processing... 
    return("some.jsp"); 
} 
+0

嘿,我沒有範圍從控制器返回它,它必須在JSP本身處理。 – Rajasekhar 2013-03-08 12:37:12

+1

你不能僅僅使用JSP來處理它,因爲標籤由Spring管理,除非數據到達Spring Controller,它不能處理它,它可以! – Sudhakar 2013-03-08 12:45:52

相關問題