Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Ragini Shukla
Hiiii
1 Answer(s)      6 years and 4 months ago
Posted in : Java Beginners



Advertisement
View Answers

September 9, 2008 at 5:35 PM


Ragini I already send the jsp pages check. if not getting copy from here

page1.jsp
--------------

<html>
<body>
<form action="page2.jsp">
<input type="text" name="srch">
<input type="submit" value="submit">
</form>
</body>
</html>


page2.jsp
------------

<%@ page import="com.Test2" %>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.ResultSet"%>
<html>
<body>
<%
String name = request.getParameter("srch");
String srch = "select name from Mytable where name LIKE '%" + name + "%'";
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/testing";, "root", "");
System.out.print(name);
Test2 test2 = new Test2();
test2.setString(name);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(srch);
if(!rs.next()){
out.println("No Record Found");
}else{
rs = stmt.executeQuery(srch);
while(rs.next()){
out.println(rs.getString("name"));
}
}
}catch(Exception ex){
System.out.println("Exception");
}
%>

</body>
</html>

Are you getting SCJP material or not;

Thanks
Rajanikant


Related Tutorials/Questions & Answers:
Advertisements
RAJ9992
Servlet sending image  hiiii In my html page i use how to send this image value to servlet plz be inform me anybody
input using scanner and add/sub/mul/div of a matrix
input using scanner and add/sub/mul/div of a matrix  hiiii...... performe matrix add/sub/mul/div using scanner
RAJ9992
Send Image Value to Servlet  hiiii In my html page i use input type=image src="" value="" name="" how to send this image value to servlet plz be inform me anybody
meenakshi
meenakshi  HIIII, Any one can help me,, I have created a form in jsp and bind it by using spring:bind in spring. I have use ModelAndView of SimpleFormController . But when i called onSubmit thn onSubmit not called
login data
login data  Hiiii Sir I am doing banking project on Asp.net i have created database on sql and also created a connection to gui but m not getting the data after login i want to show particular data for particular user means if i
login data
login data   Hiiii Sir I am doing banking project on Asp.net i have created database on sql and also created a connection to gui but m not getting the data after login i want to show particular data for particular user means
error in accessing database - JSP-Servlet
error in accessing database  hiiii im tanushri im tryng to connect my database to the servlet i hv succeeded in connectivity but im stuck to nother error called Got minus one from read call although i hv feeded data to my
error got minus one from read call - JSP-Servlet
error got minus one from read call  hiiii while connecting my servlet to database im getting error called java.sql.SQLException: Io exception: Got minus one from a read call oracle.jdbc.dbaccess.DBError.throwSqlException
Advertisements
 

 

 

DMCA.com