Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

"gifs" modelMap key declared in two places

Hi,

Does @Chris Ramacciotti or somebody else can clarify my consideration about adding entries to modelMap? In this challange entry to modelMap with key "gifs" is being added in two places : GifController and CategoryController. To put it simple, how it is possible? Does one of them override the other ? Does modelMap is global data structure or it is bound to certain method?

Regards, Adam

1 Answer

Hi Adam,

to make it short, the modelMap is only bound to local scope in the controller methods. The modelMap of the gifDetails() method of the GifController class is only bound to the scope of this gifDetails() method. Perhaps have a look at this link and see if it helps you understand the concept: Java scopes

Kind Regards, Florian

Generally I understand concept of scopes but firstly I thought that Spring framework maintains an instance of modelMap to global use. Thanks for clarify this.