Java Answers

Java Answers

How to Dispaly  databsae records in my jsp page using collections  Java Class
View Answers

August 24, 2011 at 10:24 AM

1)BeanServlet.java:

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

public class BeanServlet extends HttpServlet{
    protected void doPost(HttpServletRequest req, HttpServletResponse res)
        throws ServletException, IOException{

ArrayList list=new ArrayList();
try{
     Class.forName("com.mysql.jdbc.Driver");
           Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
           Statement st=con.createStatement();
           ResultSet rs=st.executeQuery("select * from employee");
           while(rs.next()){
               list.add(rs.getString("name"));
               list.add(rs.getString("address"));
               list.add(rs.getString("contactNo"));
               list.add(rs.getString("email"));
}
req.setAttribute("data", list);
        RequestDispatcher rd = req.getRequestDispatcher("/jsp/beandata.jsp");
        rd.forward(req, res);
}
catch(Exception e){
}
    }
}

2)beandata.jsp:

<%@page language="java" import="java.util.*" %>
<html>
<body> 
<table border="1" width="303">
<tr>
<td width="119"><b>Name</b></td>
<td width="168"><b>Address</b></td>
<td width="119"><b>Contact no</b></td>
<td width="168"><b>Email</b></td>
</tr>
<% Iterator itr;%>
<% List data=(List)request.getAttribute("data");
for(itr=data.iterator(); itr.hasNext(); ){
%>
<tr>
<td width="119"><%=itr.next()%></td>
<td width="168"><%=itr.next()%></td>
<td width="168"><%=itr.next()%></td>
<td width="168"><%=itr.next()%></td>
</tr>
<%}%>
</table>
</body>
</html>









Related Tutorials/Questions & Answers:
Java Answers
Java Answers  How to Dispaly databsae records in my jsp page using collections Java Class   Visit Here
Java Answers
Java Answers  How to Dispaly databsae records in my jsp page using collections Java Class   Visit Here
Advertisements
Java Answers
Java Answers  How to Dispaly databsae records in my jsp page using collections Java Class   Visit Here   For getting records from database to java collections you want to do following steps. 1.Declare
Java Answers
Java Answers  How to Dispaly databsae records in my jsp page using collections Java Class   1)BeanServlet.java: import java.io....){ } } } 2)beandata.jsp: <%@page language="java" import="java.util.*" %> <
Java interview questions and answers
Java interview questions and answers   what is garbage collection? What is the process that is responsible for doing that in java? Ans.Reclaiming... in Java? Ans. Runtime.getRuntime().exec(â?¦.) 5.What is the basic difference
oop answers - Java Beginners
. Write a Java statement that prints the values of the instance variables of x. i. Write a Java statement that creates the XClass object t and initializes
Core Java Interview questions and answers
Core Java Interview questions and answers  ... and answers in one place.ADS_TO_REPLACE_1 These Core Java Interview Questions... to find the answers. We are constantly trying to provide best Core Java Interview
Java Interview Questions with Answers
Java Interview Questions with Answers for freshers Are you looking for largest... in Java. Go through all these interview questions and this will help you in refreshing your Java programming knowledge. Java is very popular programming
java apptitude question and answers - Java Beginners
java apptitude question and answers  i want java appititude question and answers  Hi Friend, Please visit the following link: http://www.roseindia.net/interviewquestions/ Thanks
Plz give the answers - Java Interview Questions
), is the number itself. Write a JAVA program to find all perfect numbers between 2... information,Examples and tutorials on java visit to : http://www.roseindia.net/java/ Thanks
ModuleNotFoundError: No module named 'answers'
ModuleNotFoundError: No module named 'answers'  Hi, My Python... 'answers' How to remove the ModuleNotFoundError: No module named 'answers... to install padas library. You can install answers python with following command
Software Questions and Answers
the answers of the questions asked. JavaMail - Java API to send...Software Questions and Answers       View Software Questions and Answers online Discuss Software
Questions and Answers Help
://www.roseindia.net/answers/viewqa/Java-Beginners/11976-Java-Hello-World-code...Questions and Answers Help      ... programmers to give precise answers to your question. Describe your question
Questions and Answers Help
://www.roseindia.net/answers/viewqa/Java-Beginners/11976-Java-Hello-World-code...Questions and Answers Help      ... programmers to give precise answers to your question. Describe your question
Outsourcing - Answers to Critism, Outsourcing Answers Critics
Outsourcing - Answers to Criticism, Outsourcing Answers Critics Introduction As the outsourcing juggernaut rolls on, business analysts have come up with arguments favoring and criticizing it. Cost savings
I want this jsp answers
I want this jsp answers    How can we declare third party classes and interfaces inside our jsp page? How can we declare and definr global variables... jsp page, server can develop a .java file for a particular jsp page or not? What
I want this jsp answers
I want this jsp answers    How can we declare third party classes and interfaces inside our jsp page? How can we declare and definr global variables... jsp page, server can develop a .java file for a particular jsp page or not? What
ModuleNotFoundError: No module named 'djaodjin-answers'
ModuleNotFoundError: No module named 'djaodjin-answers'  Hi, My... named 'djaodjin-answers' How to remove the ModuleNotFoundError: No module named 'djaodjin-answers' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'djaodjin-answers'
ModuleNotFoundError: No module named 'djaodjin-answers'  Hi, My... named 'djaodjin-answers' How to remove the ModuleNotFoundError: No module named 'djaodjin-answers' error? Thanks   Hi, In your
Software Questions and Answers
Software Questions and Answers View Software Questions and Answers online Discuss Software development questions, ask your questions and get answers... browse through these questions to find the answers to your software development
ModuleNotFoundError: No module named 'dt-send-answers'
ModuleNotFoundError: No module named 'dt-send-answers'  Hi, My... named 'dt-send-answers' How to remove the ModuleNotFoundError: No module named 'dt-send-answers' error? Thanks   Hi, In your python
ibm data science professional certificate answers
ibm data science professional certificate answers  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: ibm data science professional certificate answers Try to provide me
plz Help me find the correct programs answers
INDICA" and "TATA NANO" respectively. Plz mail me your answers
Interview Questions and Answers
Interview Questions and Answers   ... that there cannot be just one answer to them. Your answers depend a lot on your particular... such questions, rather than specific answers. ADS_TO_REPLACE_1 Remember, what you
Big Data tutorials, technologies, questions and answers
Big Data technology tutorials, questions and answers Big Data technologies are here to help companies to analyze huge set of data generated through various... and questions and answers on various Big Data technologies.ADS_TO_REPLACE_1
please help me to answers this question about C++.....huuhuhuhu
please help me to answers this question about C++.....huuhuhuhu  1) Write a full program for the bubble sort algorithm. User is required to enter specific input numbers and the program will be able to sort the given numbers
please help me to answers this question about C++.....huuhuhuhu
please help me to answers this question about C++.....huuhuhuhu  1) Write a full program for the bubble sort algorithm. User is required to enter specific input numbers and the program will be able to sort the given numbers
how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers
how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers  how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers
problem question please need urgent answers
problem question please need urgent answers
java - Java Beginners
java  simple java program questions with answers
Question Answer
, please follow these steps:ADS_TO_REPLACE_1 Only post your Java or Open... relating to Java or java relating fields will only be responded. Posting... questions related to programming technologies such as Java. .NET, C#, C, C
Common Interview Questions and Their Answers.
Common Interview Questions and Their Answers.... The most important part of these is your answers. Also make sure to check how.... The answers given in this article should act as indicators. You should
Hadoop Interview Questions and Answers
Top Hadoop Interview Questions and Answers Hadoop is Big Data platform begin..._TO_REPLACE_1 In this section we are giving you the top interview questions and answers of Apache Hadoop. Interview questions with answers of Hadoop
Question-Answer Guidelines
and get their answers? RoseIndia Q&A service is only for troubleshooting the Java... relating to only Java and OpenSource field. The user must post the problem under... the answers of the questions can be sent. The asking question must
java
java  pls send me some java basic interview questions with answers
hint - Java Interview Questions
hint  Dear roseindia, i want the java interview question and the corresponding question answers.   Hi Friend, Please visit... of interview questions and their answers. Thanks  thanks for your
java interview question and answer - Java Interview Questions
java interview question and answer   sir, i want one mark java interview question and answers
JAVA connection pooling - Java Interview Questions
JAVA connection pooling  how to do JDBC connection pooling in Apache...://www.roseindia.net/jsp/jspfundamentals.shtml http://www.roseindia.net/answers/viewanswers/3338.html http://www.roseindia.net/answers/viewanswers/2838.html
Java/PHP Developer
Java/PHP Developer  Hi, can u help me with, question from a text file and answers from another text file with check box
AES decryption in Java
AES decryption in Java   AES decryption in Java with password ?    http://www.roseindia.net/answers/viewqa/Java-Beginners/26020-AES...; http://www.roseindia.net/answers/viewqa/Java-Beginners/26020-AES-Decryption
Oracle Certifications 1Z0-1045-22 Exam Questions and Answers
Oracle Certifications 1Z0-1045-22 Exam Questions and Answers Oracle Warehouse Management Cloud 2022 Implementation Professional Cloud creator .... Popular Cloud Certifications Exam 1Z0-1045-22 Questions Answers Almost 
java regular expression
java regular expression  hi i need java expression which allows all characters with minimum 2 characters and maximum 20 characters in answers field after selecting security questions
java beginner
java beginner  Write a program that will grade the students quiz... the user to enter the student answers to be checked and show the number of right answers and the final grade as a percentage. The program will ask if the user want
What Delhi is Famous For
What Delhi is Famous For? It is a Herculean task to find the answers for what Delhi is famous for. There could be more than one answers and every answer hold a substantial amount of importance. There are a number of monuments, forts
Java
Java  Hoe to convert excel file into postgrey database??   Please visit the following links: http://www.roseindia.net/tutorial/java/poi/insertExcelFileData.html http://www.roseindia.net/answers/viewqa/Java
java
java  Please send me some question and answers regarding interview .....   Hi Anitha, Please go through the below blog, you will get some information related to Java like. http://www.roseindia.net/java/ All
iPhone 3G FAQ
iPhone 3G FAQ       If you are looking for answers to all your iPhone queries and doubts, look no further. We offer simple, straightforward answers to all the iPhone questions
Ask PHP Questions
; PHP Questions and Answers Ask PHP Questions and get answers from... ASAP.ADS_TO_REPLACE_1 In your questions and answers section you can ask PHP questions and get answers quickly from our users. Our team will also try to provide
java - Java Beginners
Installing Java   How can i install java on my system and what i need to download ...also from where i can download?  Hello,Please check the url http://www.roseindia.net/answers/viewanswers/328.htmlThanks

Ads