Reputation: 313
I'm new to Spring roo and working on my first application. I read the "Spring Roo in action" but one question I do not got answered.
I have a one-to-many relationship. When listing the many table/object I want to show one field from the related parent. Now I get all fields of the parent concatenated.
I already figured out that in the create.jspx and update.jspx views one can use the itemLabel="fieldName" notation and this works fine.
But what is the equivalent for the show.jspx and list.jspx views?
Upvotes: 1
Views: 136
Reputation: 313
Probably the toString() method worked in the past, but in the 1.3.1 version this does not solve the problem, at least for the jspx views, see Chapter 11. Web MVC Add-On, see 11.2. Application Conversion Service.
Instead you have to "push-in" the .getToStringConverter() methods in the ApplicationConversionServiceFactoryBean_Roo_ConversionService.aj to ApplicationConversionServiceFactoryBean.java
and customize it as you like.
Upvotes: 1
Reputation: 2663
You get all fields of parent because jspx is using the toString
method of the parent to transform object to a String value.
The easy and faster way to solve this is push-in the toString
method form the .aj file to .java and customize the return of this method. Spring Roo when found the method on .java file will not generate it again.
Good luck!
Upvotes: 1