Grails Goodness: Type Conversion on Parameters

With Grails we get a lot of extra support for handling request parameters. We can convert a request parameter value to a specific type with a simple method invocation. Grails adds for example the method int() to the parameter so we can return the request parameter value converted to an int. Grails adds several methods like byte(), long(), boolean() we can use in our code.

 

We can run the following testcase to test the various parameter types and values

 

發佈了43 篇原創文章 · 獲贊 1 · 訪問量 20萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章