I'm working on creating a comment system so essentially I have a form which on submit pushes the values into the database.
However I want to display all the previous comments on the page too. So its simplistic to have them display by using: form in JSP view->servlet controller->Java model (validation, database, etc)->servlet response gets all the comments->JSP view displays them.
My question is how do I get to my Java model's getComments() function before submitting the form? Is there an option besides scripting it all in the JSP page? Is there some way to directly call a seperate method inside my Servlet controller that doesn't have to be associated with the same request that submitting a new comment from the form will have?
Originally posted by Ben Souther:
If you can query the database with JSTL-SQL tags in the JSP, then you can do it from a bean before forwarding to the JSP.
Either way, it's all happening in the same request.
The form submission would be a new and entirely new request.
I'll look into that. If anyone has any links related to this that would be helpful.