magno32 (1) [Avatar] Offline
#1
I have a question about Section 5.5.6 in Chapter 5.

I'm trying to get the second bullet working but am having a good bit of trouble.

Without digging too much, I wanted to mention that the code snippet with the field:select tag is missing the 2 required values "items" and "path". These are also omitted from the source code (checked out from git). It is quite possible that I will still have problems even if those values were filled, but perhaps their correct values for a custom ModelAttribute method would help.

Thanks!
ken.rimple (246) [Avatar] Offline
#2
Re: Chapter 5 View Enhancement - Lists of Values
Sorry, I just saw this. I'll put it on my list of things to check.

Ken
ken.rimple (246) [Avatar] Offline
#3
Re: Chapter 5 View Enhancement - Lists of Values
Quick question - we've split some of the chapter 5 content into the next chapter now - are you talking about providing reference data, as in:

@ModelAttribute("offerings")
public Collection<Offering> OfferingController.populateOfferings() {
return Offering.findAllOfferings();
}

If so, yes, you'd need to use the Spring Roo tag select.tagx:
<field:select >
field="offering"
items="${offerings}"
itemlabel="offerDate"
itemValue="id"
.../>

Path should have been there, but if you are providing the offering ID, here is the way Roo is using it in chapter-06/coursemanager.../registrations/create.jspx:
...

<field:select field="offering" >
id="c_org_rooinaction_coursemanager_model_Registration_offering"
itemValue="id" items="${offerings}" path="/offerings"
z="9/MyCIuDTLbOnBq/nHPPDXufjFA="/>

You could easily add itemLabel="runDate" or something like that from the fields of the offering.

I don't know that I have an example in there with the original Spring MVC tags, but they would use the path item too.

Let me know if I'm on the right path here with your question. Sorry it took me a while to see this one - I had been working on a time sensitive project from before Christmas until last week.