开发者

Grails object marshalling - adding data type hints?

开发者 https://www.devze.com 2023-03-16 06:08 出处:网络
I\'d like to be able to have something like this: <form> <input type=\"date\" name=\"params.date\"/>

I'd like to be able to have something like this:

<form>
<input type="date" name="params.date"/>
<input type="text" name="params.myString"/>
</form>

And marshall this to

Map<String, Object> params
   ['date': (Date object),
    'myString': (String)]

inside of a command object holder as such:

class Holder{
   def params
   def unshownAttributes
}

I thought about doing some hackery involving javascript to parse out a data-type HTML5 attribute and prepren开发者_C百科ding the name (and fixing up the types later), but I was hoping there was a better way to do this automatically with groovy or grails.

Any thoughts?


No such mechanism currently exists. You may save yourself some pain by just creating methods for every marshalling instance you need with proper command objects.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号