aspose file tools*
The moose likes JSP and the fly likes getting data from mysql without clicking on search button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "getting data from mysql without clicking on search button" Watch "getting data from mysql without clicking on search button" New topic
Author

getting data from mysql without clicking on search button

sai muthe
Greenhorn

Joined: Oct 18, 2012
Posts: 1

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

Joined: May 15, 2011
Posts: 34

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.



A web application developer wannabe from Thailand
My StartUp : http://www.dreamlog.co
Blog : http://pongsakornsemsuwan.wordpress.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getting data from mysql without clicking on search button
 
Similar Threads
servlet is not working properly
when i retrive data from access it showing empty page in tomcat
Servlet and XML result HTTP 404
JSP two pages
Unable to find specific product