Like here in stackoverflow if i force put bad characters on URL in id place it redirects you to a page error. I would like to know if with Grails it has some kind of plugin for prevent id like: "123$#3" or an easy way because i have a lot of actions and do something like below dont seems to be the best way:
def find = {   
     def val = OwnStringUtilsClass.verify(params.id)
     val ? Book.get(val) : response.sendErr开发者_StackOverflow社区or(404)
}
You can use the following in grails-app/conf/UrlMappings.groovy:
  "/$controller/$action?/$id?"{
          constraints {
                    id(matches:/\d*/)
              }
      }
This will ensure that the id is numeric.
You could try using a controller filter.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论