I have been reading a lot on MVC but really don't know if i am clear on the concepts of MVC or not
recently developed an application what i did is
1)on jsp load called a function
2)using AJAX called a servlet and servlet is there performing all the logic
3)servlet called a java bean and a java class to perform some logic and return result
4)based on the result returned form the class i am displaying an image say if result is 1 then image A ,if 0 then Image b
5)on servlets POST method i am using out.println()-->to write the complete output
6)the function on jsp after returning the call will set the innetHTML of required div by the output generated by the servlet
now say the output servlet is producing is the table
instance name|instance state
now if i want at some time to change the display for this table to say
instance state|instance name
to do the above mentioned change i have to recompile my servlet and redeploy the war
is it really a MVC?
and someone suggested me to use JSON store object of a bean containing data as JSON and then return the JSON object to the jsp
and at jsp using this object contruct the table!
To over-come this , it is most preferred to use some MVC framework ( struts or spring or play ) where you map an actual JSP page with the result obtained from response servlet. In these frameworks, the servlet is just responsible to handle java code and then return a result . The framwork then decides which view ( JSP ) to display by parsing through a configuration file ( usualy an xml file ) based on the returned result.
The rest of the steps you mentioned are all correct in accordance with MVC architecture.
Muhammad Saif Asif Mirza
OCJA(5/6) OCJP(6) OCJWCD(6)