Ecosystems support food webs by providing a diverse range of habitats and resources for various organisms to thrive. Producers, such as plants and algae, form the base of the food web by converting sunlight into energy through photosynthesis. Herbivores then consume these producers, followed by carnivores that feed on herbivores. Decomposers break down dead organisms and recycle nutrients back into the ecosystem. This interconnected network of feeding relationships within an ecosystem allows for energy transfer and nutrient cycling, ultimately supporting the balance and stability of the food web.