Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting data from mysql without clicking on search button

 
sai muthe
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
Pongsakorn Semsuwan
Ranch Hand
Posts: 34
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic