I have yet another MVC question. I can't always wrap my mind around it, because I'm fairly new to the concept...
Anyways. Please take a look at the following image and let me know if you have any suggestions as of how to better implement the solution:
It should provide searching capabilities for a SQL database.
search.jsp - displays the form, sends it to the servlet and should display the results. VIEW search.do - servlet that receives data and prepares the response by accessing a few java classes CONTROLLER dbConn.java - connects to the db MODEL validate.java - checks user input MODEL searchDTO.java - data class (to store individual results), will be a member of ArrayListMODEL
Please let me know if I got the concept right....
Also, please suggest a way to send the results to jsp... (On jsp, I guess, I will use jstl to render the results.)
Thank you very much, any help would be appreciated!
ya. it is fine to me with one changes in your order . dbConn.java - connects to the db MODEL[DAO] should come after the validate.java - checks user input MODEL[related to the controller][carefully see the steps in your diagram ]
Joined: Oct 22, 2009
seetharaman venkatasamy wrote:ya. it is fine to me with one changes in your order . dbConn.java - connects to the db MODEL[DAO] should come after the validate.java - checks user input MODEL[related to the controller][carefully see the steps in your diagram ]
Thanks for your response!
I actually do verify user input before querying the database. If it isn't valid, I go straight to step 6 (i.e. send error msg to jsp).
The only thing that I don't really know yet, is what is the most efficient way to send the response to jsp... Should I use a RequestDispatcher (which is sort of confusing to me), or something else?
On my other jsp page I access DAO object directly through jstl to populate a drop down. However, in this case I don't think that I can do so, because it complicates things..
Joined: Oct 22, 2009
Happen to close my own topic again =)
Anyways, I guess, just for the reference of whoever will be looking for a similar solution, I will post what I found...