tags:

views:

59

answers:

4

Hi there

let's consider a web application built using MVC concept. If my application generates some chart images dynamically based on the user input and a database I wish to know which component the image generation process will belong to: controller or view?

It's controllers job to generate the image and the view component to display it?

+1  A: 

in short, yes you are correct.

jldupont
+1  A: 

yes, but i would make a class that generate the chart which would be invoked by the controller

Yassir
+1  A: 

You are correct, a controller should generate the image and the view should display it. This would most likely be handled by a setting the "src" attribute of an image to a controller/dispatch that streams binary data, but it's up to you how exactly you implement that.

Myles
+1  A: 

The controller is responsible for coordinating the generation of the image. The image can be generated by an HttpHandler, some other component capable of generating the stream or static resource that should be returned.

As an addition to the other answers, here's an example.

PHeiberg