This week's giveaway is in the Java/Jakarta EE forum. We're giving away four copies of Java EE 8 High Performance and have Romain Manni-Bucau on-line! See 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 ArrayList MODEL
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 ]
posted 8 years ago
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..
posted 8 years ago
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...