java - MvcUriComponentsBuilder and inccorect binding in Spring MVC -


code

i have controller method this:

@requestmapping("/{userid}/{configid}") def edit(@pathvariable("userid") user user,          @pathvariable("configid") configuration configuration) {     /* code here*/ } 

when call method browser works well, , user, , configuration args bind database id.

problem

but, when used mvcuricomponentsbuilder class, got exceptions incorrect arguments type in expected method.

mvcuricomponentsbuilder.frommethodname(mycontroller.class, "edit", 1, 2).build() 

exception

java.lang.illegalargumentexception: source convert must instance of @org.springframework.web.bind.annotation.pathvariable user; instead java.lang.long 

faced body similar problem? there solution?

note: i'm using spring web mvc 4.1.8.release

a bit more descriptions

i'm using mvcuricomponentsbuilder in thymeleaf template this:

th:action="${#mvc.url('cc#edit').arg(0, configuration.access.id).arg(1, configuration.id).build()} 

as docs says in arg method should passed native method arg (in example should passed user , configuration instances). but, in opinion better solution using long values (for example) , autobind object expected (as works on browser call)

additional info!

i listened @sotirios delimanolis, , use function described in docs

th:action="${#mvc.url('cc#edit').arg(0, configuration.access.user).arg(1, configuration).build() 

passed arguments correct in example.

but, have gotten exception again!

org.springframework.core.convert.converternotfoundexception: no converter found capable of converting type @org.springframework.web.bind.annotation.pathvariable @org.springframework.web.bind.annotation.modelattribute ua.smartsteamshop.web.app.domain.user type java.lang.string 

it looks bug! guys, need help! question should discussed!


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -