profile display

profile display

JSP Servlet Search Page

View Answers

April 9, 2012 at 3:42 PM

1)search.jsp:

<html>
<head>
</head>
<body>
<br><br><br><br><br><br></p>

<form method="post" name="frm" action="..//search">
<table border="0" width="300" align="center" bgcolor="#CDFFFF">
<tr><td colspan=2 style="font-size:12pt;color:#00000;" align="center">
<h3>Search Item</h3></td></tr>
<tr><td ><b>Item Starts With</b></td>
<td>: <input type="text" name="name" id="name">
</td></tr>
<tr><td colspan=2 align="center">
<input type="submit" name="submit" value="Search"></td></tr>
</table>
</form>

<p></body>
</html>

2) Search.java:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.sql.*;
import java.sql.*;
import java.util.*;

public class Search extends HttpServlet{
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException,IOException{
response.setContentType("text/html");
PrintWriter out = response.getWriter();

System.out.println("MySQL Connect Example.");
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";;
String dbName = "register";
String driver = "com.mysql.jdbc.Driver";
String userName = "root";
String password = "root";

Statement st;
try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url+dbName,userName,password);
System.out.println("Connected to the database");
String name = request.getParameter("name");
String query = "select * from item where name LIKE '"+name+"%'";
st = conn.createStatement();
ResultSet rs = st.executeQuery(query);
out.println("<table border='1'><tr><th>Row Num</th><th>Item Code</th><th>Item Name</th><th>Item Price</th></tr>");
while(rs.next()){

out.println("<tr><td>"+rs.getString(1)+"</td><td>"+rs.getString(2)+"</td><td>"+rs.getString(3)+"</td><td>"+rs.getString(4)+"</td></tr>");
}
out.println("</table>");
conn.close();
System.out.println("Disconnected from database");
} catch (Exception e) {
e.printStackTrace();
}
}
}

3)web.xml:

<servlet-name>searchServlet</servlet-name>
<servlet-class>Search</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>searchServlet</servlet-name>
<url-pattern>/search</url-pattern>
</servlet-mapping>

April 9, 2012 at 3:43 PM









Related Tutorials/Questions & Answers:
profile display
profile display  how to display matching jobs in jobseeker's profile using jsp-servlets?   Please visit the following links: http://www.roseindia.net/servlets/search.shtml http://www.roseindia.net/jsp/user
profile display
profile display  Search page to display matching results in JSP and Servlet   Please visit the following links: http://www.roseindia.net/servlets/search.shtml http://www.roseindia.net/jsp/user-search.shtml
Advertisements
profile display
profile display  how to display matching Results using jsp-servlet?   Please visit the following links: http://www.roseindia.net/servlets/search.shtml http://www.roseindia.net/jsp/user-search.shtml http
profile display
profile display  Is it possible to create a user profile in Servlet and JSP   Please visit the following links: http://www.roseindia.net/servlets/web-application.shtml http://www.roseindia.net/jsp/user-registration
profile display
profile display  How to create a user profile in JSP   Please visit the following links: http://www.roseindia.net/servlets/web-application.shtml http://www.roseindia.net/jsp/user-registration-form-using-jsp.shtml
profile display
profile display  Create Jobseeker's profile in JSP and Servlet   Please visit the following links: http://www.roseindia.net/servlets/web-application.shtml http://www.roseindia.net/jsp/user-registration-form-using
profile display
profile display  Fetch Matching jobs in JSP Servlet  Please visit the following links: http://www.roseindia.net/servlets/search.shtml http://www.roseindia.net/jsp/user-search.shtml http://www.roseindia.net/jsp
profile display
profile display  JSP Servlet Search Page   1)search.jsp: <html> <head> </head> <body> <br><br><br><br><br><br></p> <form method="post" name="frm
display
display  please tell me how to display the content from database.. if we click on any image using servlets/jsp...please
profile page
can display in home pages in all user login.but problem in user goto profile page i want to display only status photo display.how can itis possible. i am using...profile page  sir, i am beginer in php i am creating simple web
update profile
update profile  coding for update profile
Editing the Profile
Editing the Profile  how to populate drop-down menu instead of text box in editing the profile
coding for updating profile
coding for updating profile  coding for updating profile
coding for update profile
coding for update profile  coding for update profile
ModuleNotFoundError: No module named 'profile_it'
ModuleNotFoundError: No module named 'profile_it'  Hi, My Python... 'profile_it' How to remove the ModuleNotFoundError: No module named 'profile_it' error? Thanks   Hi, In your python environment you
image display
image display  Hai Friends..... Actually I uploaded filepath into database and image into a folder. Now i want to show that image as my profile photo. How it is?...Friends Can you help me? Thanks in advance to take time
image display
image display  Hai Friends..... Actually I uploaded filepath into database and image into a folder. Now i want to show that image as my profile photo. How it is?...Friends Can you help me? Thanks in advance to take time
Display Problem
Display Problem  i am creating a small window application , i want to fetch data from ms-access(db) and want to display it on tables. what options are there to show result on table. is CSS helpfull
how to display?
how to display?  How to write a select query for displaying data where i have author as multivalued attribute
how to display?
how to display?  How to write a select query for displaying data where i have author as multivalued attribute
how to display?
how to display?  How to write a select query for displaying data where i have author as multivalued attribute
Display data
Display data  after successful login how i can fetch my account information from sql database
Display Information
Display Information  I have a listbox having many names and I have a button "display". I select some names and when I click the button , the names along with the address(they are in database) should be displayed. I am using php
image display
image display  sir the answer which you have sent to me is already I have I want to know that the syntax which you have writen for display... to display in image from databse plz help me i will wait for ur reply
Display Tag
Display Tag  Hi Here is My code, There is problem At line no.3, where i want to display two fields in one column but it gives error.. Please any one knows the solution must reply Thanks In Advance
display result
display result  i want a code that takes input from user through dropdown box and display the result into table.all the values regarding the user input must be displayed. i am using mysql database   hi i want study
Display Tag
Display Tag  Hi Here is My code, There is problem At line no.3, where i want to display two fields in one column but it gives error.. Please any one knows the solution must reply Thanks In Advance
Retina Display
Retina Display  is it possible to test Retina Display on simulator?   Yes, run the application from Xcode, when the simulator opens go to Hardware->Device->iPhone 4 That will now have a 2x screen resolution
display shapes
display shapes  Hi, I would like to see geometric shapes like square, triangle, circle, rectangle as my outputs. Also, those figures shouldn't overlap while they get displayed. Please help me
image display in jsp - Java Beginners
image display in jsp  i uploaded the image and how can i print that image in next jsp page....  Hi friend, read for more information, http://www.roseindia.net/jsp/file_upload/employee_upload_profile_image.shtml
image display
image display  sir the answer which you have sent to me is already I have I want to know that the syntax which you have writen for display... to display in "div image from databse /div" plz help me i will wait for ur reply
Display Configurations
Display Configurations   The year is 2136. A lot of things have changed but BITS Pilani still exists. The display technology used now is a WASDLED screen. This display technology consists of a configuration matrix containing
user profile - JSP-Servlet
user profile  how to create a user profile for each user in the database and enable the user to modify it using jsp
display
display
Display patterns
Display patterns  Write a test program that read an integer n and call a method to display a pattern as follows: 1 2 1 3 2 1 4 3 2 1 ... n n-1 ... 3 2 1 The method header is public static void displayPattern(int n)   
Display patterns
Display patterns  Write a test program that read an integer n and call a method to display a pattern as follows: 1 2 1 3 2 1 4 3 2 1 ... n n-1 ... 3 2 1 The method header is public static void displayPattern(int n)  
Update Profile
Update Profile       Update Profile This facility is used for updating user... Profile Menu, all the information is fetched from the database and set
image display
image from access database but Sir I want that how I display image from database
Display image
Display image  How to Pass image from html to jsp and display... the html page to jsp page and display it. 1)page.html: <%@ page language="java" %> <HTML> <HEAD><TITLE>Display file upload form
profile doesn't match application identifier
profile doesn't match application identifier  profile doesn't match application identifier
how to display?
how to display?  I have to write a code for searcing books in library and i have written but it is not displaying the result.I don't know where i have gone wrong.Also i want to know if there is any better idea then this and what
Version of com.scalaone>xsbt-profile dependency
List of Version of com.scalaone>xsbt-profile dependency
video display in html
video display in html  how to display video file in html
display database results
display database results  how to display database results using php
ModuleNotFoundError: No module named 'aws-profile'
ModuleNotFoundError: No module named 'aws-profile'  Hi, My Python... 'aws-profile' How to remove the ModuleNotFoundError: No module named 'aws-profile' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'django-profile'
ModuleNotFoundError: No module named 'django-profile'  Hi, My... named 'django-profile' How to remove the ModuleNotFoundError: No module named 'django-profile' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'mongo-profile'
ModuleNotFoundError: No module named 'mongo-profile'  Hi, My... 'mongo-profile' How to remove the ModuleNotFoundError: No module named 'mongo-profile' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'profile-block'
ModuleNotFoundError: No module named 'profile-block'  Hi, My... 'profile-block' How to remove the ModuleNotFoundError: No module named 'profile-block' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'profile-middleware'
ModuleNotFoundError: No module named 'profile-middleware'  Hi, My... named 'profile-middleware' How to remove the ModuleNotFoundError: No module named 'profile-middleware' error? Thanks   Hi, In your

Ads