[英]type mismatch; found : Int required: String when trying to persist the form data in play framework
[英]play framework type mismatch; found : Int required: String
我是Play框架和Scala的初學者,我正在嘗試使用Scala上的Play開發一個簡單的Web項目,我正在使用eclipse IDE!
我的問題是當我更改視圖模板的參數時,盡管事實上我在調用此視圖的Action中傳遞了“相同的新”參數,但是我有這樣的錯誤:
type mismatch; found : Int required: String
為簡化起見,假設我們有一個視圖作為參數@(value:String)
因此我可以從Action Ok(html.say(value))
調用此視圖,例如將value聲明為String。
在這種情況下,一切都很好!
但是當我更改視圖的參數以獲取Int @(value:Int)
並且我從帶有Ok(html.say(value))
的操作Ok(html.say(value))
調用此視圖時盡管我將值的類型從String更改為Int,但是得到:
Compilation error: type mismatch; found : Int required: String
我對這個項目做了很干凈,但沒有幫助。 問題是什么?
確保通過鍵入compile
或重新加載頁面(在運行應用程序時)從Play控制台進行compile
。 那將重新編譯模板。 然后,您可以刷新Eclipse以使其獲取更改。
在Play Framework上發布任何問題之前,應該運行“play clean compile”命令。 它解決了95%的此類問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.