getting data from mysql without clicking on search button
posted 3 years ago
in this we got the mid from allmeters.jsp,when clicking on hyperlink in allmeters.java that value is displayed in demo.jsp,in this we have a search button and with out clicking on button it is retrieving data from mysql database and displaying,so i want to retreive data from mysql after clicking on search button please explain me in detail
Keep your mid in your search form (the one with search button) using <input type="hidden" >
In your Demo.jsp, add a condition to see if request is come from Demo.jsp itself. (maybe check for the search button?). If request is not from search button, then do not connection to db. Instead, display a blank page with search form.
In Demo.jsp again, you have to set action of search form to itself. maybe <form action="" I'm not sure
By the way, MVC concept is highly recommended for web application development Putting both logic, view , even connection to DB in jsp is quite unsophisticated.