Home Answers Viewqa Development-process jsp with database..

 
 


gautam jagnani
jsp with database..
2 Answer(s)      3 years ago
Posted in : Development process

Hello i need code for.....

I have a car brandimage on my front page.on clicking it it is directed to a model.jsp page.....what i need is on clicking a particular brand only the corresponding models of that brand should be retrieved from database.i have created a table in database which have brand,model,price as attributes.

thanks.
View Answers

May 28, 2010 at 4:36 PM


Hi Friend,

Try the following code:

1)index.jsp:

<html>
<form action="model.jsp">
<center><input type="image" src="car.jpg" ></center>
</form>
</html>

2)model.jsp:

<script language="javascript" type="text/javascript">
function call(brand){
window.open('info.jsp?brand='+brand,'mywindow','width=400, height=250,toolbar=no,resizable=yes,menubar=yes');
}
</script>
<h1>Car Brands</h1>

<a href ="javascript:call('Tata')">Tata </a><br><br>
<a href ="javascript:call('Ford')">Ford </a><br><br>
<a href ="javascript:call('Maruti')">Maruti </a><br><br>
<a href ="javascript:call('Honda')">Honda </a><br><br>
<a href ="javascript:call('Toyota')">Toyota </a><br><br>
<a href ="javascript:call('Chevrolet')">Chevrolet </a><br><br>

3)info.jsp:

<%@page import="java.sql.*"%>
<%
String brand=request.getParameter("brand");
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root";, "root");
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery("select * from car where brand='"+brand+"'");
if(brand!=null){
%>
<center><h1><%=brand%></h1></center>
<center><table border="1" width="80%" height="50%">
<tr><th>Brand</th><th>Model</th><th>Price</th></tr>
<%
while(rs.next()){
%>
<tr><td><%=rs.getString(2)%></td><td><%=rs.getString(3)%></td><td><%=
rs.getString(4)%></td></tr>
<%
}

%>
</table></center>
<%
}
%>

Thanks

May 28, 2010 at 4:37 PM


For the above code, create database table named 'car':

CREATE TABLE `car` (
`id` bigint(255) NOT NULL auto_increment,
`brand` varchar(255) default NULL,
`model` varchar(255) default NULL,
`price` double default NULL,
PRIMARY KEY (`id`)
)

Thanks









Related Pages:
jsp database
jsp database   I want to retrive value in my jsp page but i dont want show my database query in my jsp page. is there any other method to show value in my jsp page using java class
database
database  how to search data from database using jsp & how... the following links: http://www.roseindia.net/jsp/user-search.shtml http://www.roseindia.net/jsp/searchbook.shtml
database
links: Connect JSP with database Mysql Connect Java with database Mysql...database  tell me use about database and give me a small program.   It is secure and can easily be accessed, managed, and updated. Moreover
database
links: Connect JSP with database Mysql Connect Java with database Mysql...database  tell me use about database and give me a small program.   It is secure and can easily be accessed, managed, and updated. Moreover
database
links: Connect JSP with database Mysql Connect Java with database Mysql...database  tell me use about database and give me a small program.   It is secure and can easily be accessed, managed, and updated. Moreover
connect to the database from JSP
connect to the database from JSP  How do you connect to the database from JSP?   A Connection to a database can be established from a jsp page by writing the code to establish a connection using a jsp scriptlets
connec to database - JSP-Servlet
connec to database  Need code to connect the application to database. I have developed the application JSP and Servlet
upload to database - JSP-Servlet
to upload a pdf file into database(sqlserver2000) using jsp. In roseindia some examples... into database whenever i want that uploaded pdf file i have to retrieve it from database please help me friends thanks in advance it is very urgent
connection with database - JSP-Servlet
and the connection with the database using jsp code, I get exceptions that I have... with java code. Is there any other way to establish a connection with database in jsp... with the database by writing the program in java. Following is the code: import
JSP Database Example
This example shows you how to develop JSP that connects to the database and retrieves the data from database. The retrieved data is displayed on the browser. Read Example JSP Database Example Thanks
database - JSP-Servlet
database  how to downloaad a file(doc) from database and store in any local system by using servlet
jsp with database oracle
jsp with database oracle  hai i am doing one program in jsp i want to check the jsp life cycle methods so wrote one program, in which i write jspInit() method and jspDestroy() methods. but i am getting error i crate a table
jsp with database.. - Development process
jsp with database..  Hello i need code for..... I have a car... of that brand should be retrieved from database.i have created a table in database... Thanks  For the above code, create database table named
JSP and Database access
JSP and Database access  Hi, Please help me with the following program. I am not able to update all the pa column values in my database. csea.jsp: <html> <body> <%@page import="java.sql.*"%> <form method
database through jsp
database through jsp  sir actually i want to retrieve the data from database dynamically.because i dont know how many records are there in the database? thanks   Here is an example of jsp which retrieves data from
line chart from database in jsp
line chart from database in jsp  how can i create line chart from database in jsp code
jsp and database - Java Beginners
jsp and database  I m making a project for an agentto store record using jsp and oracle database.I want that when the premium of any policy holder is half yearly or quarterly then when the person submit premium in a month lets
Jsp Code to store date in database - JSP-Servlet
Jsp Code to store date in database   Hi, Can u give me jsp code to store current date in to database. Thanks Prakash
Backup MySQL Database - JSP-Servlet
Backup MySQL Database  Database Sir I have been reading Rose's india tutorial "Using MySQL Database with JSP/Servlet". In the Tutorial you have shown an example of backing up the database. When I tried to backup database
edit values of database using jsp
edit values of database using jsp  hi i want a code to edit the row from tye database and display in a page which containd radio buttons and drop down boxes using jsp code
edit values of database using jsp
edit values of database using jsp  hi i want a code to edit the row from tye database and display in a page which containd radio buttons and drop down boxes using jsp code
database connection
database connection  how to connect the jsp page with database
To insert attachment file in database in JSP.
To insert attachment file in database in JSP.  I am doing project in JSP. How to insert attachment file in mysql database? Please suggest some solution. Your inputs is valuable to me.   Hi Friend, Visit Here Thanks
display date to jsp from database
display date to jsp from database   display date to jsp from database to calender if the start date and end date is available than calender date... not available in database field than show in green color and clickable. NOTE :- Date
Connecting to Database from a hyperlink in JSP - JSP-Servlet
Connecting to Database from a hyperlink in JSP  How can I connect to database by clicking on a hyperlink in a JSP Page.Can you please give me sample... which is connect to database using jdbc database
Problem in Jsp and database - Development process
Problem in Jsp and database  Hi, How can I reterive values from database and display them in teextboxes so that when the user select the UPDATE... to the database itself . Thanks in advance.  Hi Friend, You can use
Static database class - JSP-Servlet
Static database class  I want to create a static database class and i want to use that class in all servlets ? How can i achive
Draw graph using jsp without database connection
Draw graph using jsp without database connection  Draw graph using jsp code without database connection
How to show database values into graph using jsp?
How to show database values into graph using jsp?  How to show database values into graph using jsp
How to show database values into graph using jsp?
How to show database values into graph using jsp?  How to show database values into graph using jsp
Database connectivity with jsp code - JSP-Servlet
Database connectivity with jsp code  I have written a program in java having connectivity with online_exam. Its working properly. Connection has been... is there with jsp code.Its giving the exceptions I have posted u before. I dont know
database connectivity using jsp code
database connectivity using jsp code  i have two tables employee...),'bbbb','bbbb'); so this syntax is possible to use in jsp code based on employee id ename and designation are displayed how it is possible in jsp employee
server database connection - JSP-Servlet
server database connection  sir generally we will connect to the database by using the following steps 1.Class.forName("sun.jdbc.odbc.JdbcOdbcDriver..." in that case how we will get the database connection   Hi Friend
data are not display in JSP from database - JSP-Servlet
data are not display in JSP from database   i want to finding some data through a SQL query from SQL server database to a JSP page based on some... of this jsp page. like.. School Result and three request parameters 'class', 'from
connecting to a database dynamically - JSP-Servlet
connecting to a database dynamically   abc.html... java.lang.NullPointerException org.apache.jsp.abc_jsp._jspService(abc_jsp.java:72... with database dynamically. Plz debug the code and explain the reasons for the exception
error in accessing database - JSP-Servlet
database to the servlet i hv succeeded in connectivity but im stuck to nother... database cud ne1 help me out plss  Hi friend, Code to help in solving... to the database"); conn.close(); System.out.println("Disconnected from database
database problem
database problem  I did connect my jsp page to database and it showed the result on another jsp page but i want to show the data of that field on which i click to mouse from the jsp page where all the data field has been showed
database problem
database problem  I did connect my jsp page to database and it showed the result on another jsp page but i want to show the data of that field on which i click to mouse from the jsp page where all the data field has been showed
jsp- database dependent dropdown list
jsp- database dependent dropdown list   i want 2 dropdown list 1- CLASS 2-SECTION both are should come from database. and if i select a class... respective to that class from database. please help by providing the code in jsp
code for insert the value from jsp to access database
code for insert the value from jsp to access database  code for insert the value from jsp to access database
search functionality using jsp from database
search functionality using jsp from database  search functionality using jsp from database
jsp with excel sheet data uploading into database
jsp with excel sheet data uploading into database  how to upload data in excel sheet with jsp into oracle 10g database
how to display data from database in jsp
how to display data from database in jsp  how to display data from database in jsp
jsp
jsp  how to write hindi in jsp and store in database as unicode
jsp
jsp  how to delete data from database using jsp
Struts Database
Struts Database  Can u show me 1 example of Struts jsp using oracle 10g as database! with struts config file
Struts database
Struts database  Can u show me 1 example of Struts jsp using oracle 10g as database! with struts config file
To insert attachment file in database in JSP.
To insert attachment file in database in JSP.  I am doing project in JSP. How to insert attachment file in mysql database? Please suggest some solution. Your inputs is valuable to me.   Hi Friend, Try the following
3 dropdown list from the database using JSP
3 dropdown list from the database using JSP  Hi, I'm new to JSP I want to create 3 dropdown list each depend on the other and get the options from the database using JSP
jsp
jsp  how to connect the database with jsp using mysql   Hi Friend, Please visit the following links: http://www.roseindia.net/jsp/connectjspwith_mysql.shtml http://www.roseindia.net/jsp/Accessingdatabase-fromJSP.shtml

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.