new 2

new 2

<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
   <% 
 ArrayList<String> arr1=(ArrayList<String>)request.getAttribute("fname");
 ArrayList<String> arr2=(ArrayList<String>)request.getAttribute("email");
%>
<html>

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <table>

         <% for(int i=0;i<arr1.size();i++){ %>  
        <tr>   
        <td>
            <%=arr1.get(i)%>
        </td>
        <td>
            <%=arr2.get(i)%>
        </td>
        </tr>
        <%}%>
    </table>
</html>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2
sevelet
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 *
 * @author ignite084
 */
public class TestRadioServlate extends HttpServlet {

    /**
     * Processes requests for both HTTP
     * <code>GET</code> and
     * <code>POST</code> methods.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        HttpSession session=request.getSession(true);
        try {
            String uname="Arati";
            Class.forName("com.mysql.jdbc.Driver");
            Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/Exit", "root", "root");
            Statement stmt=con.createStatement();
            ResultSet rs=stmt.executeQuery("Select * from register");
            System.out.println("Select * from register ");
            RequestDispatcher rsd=request.getRequestDispatcher("newjsp.jsp");
            ArrayList<String> arr1=new ArrayList<String>();
             ArrayList<String> arr2=new ArrayList<String>();
            while(rs.next())
            {
//                request.setAttribute("fname", rs.getString(1));
//                request.setAttribute("email", rs.getString(2));
                arr1.add(rs.getString(1));
                arr2.add(rs.getString(2));

            }
            request.setAttribute("fname", arr1);
            request.setAttribute("email", arr2);
            rsd.forward(request, response);
        } 
        catch(Exception e)
        {
            e.printStackTrace();
        }finally {            
            out.close();
        }
    }

    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    /**
     * Handles the HTTP
     * <code>GET</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    /**
     * Handles the HTTP
     * <code>POST</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    /**
     * Returns a short description of the servlet.
     *
     * @return a String containing servlet description
     */
    @Override
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>
}
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2
View Answers









Related Tutorials/Questions & Answers:
new 2
new 2  <%@page import="java.util.ArrayList"%> <%@page...; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2 sevelet @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2 import java.io.IOException; import java.io.PrintWriter; import
new
new    hi i am jane pls explain the difference between string greeting = good morning string greeting = new string ("good morning
Advertisements
new
new    hi i am jane pls explain the difference between heap memory and stack memory
new
new  hi the difference between string sname = good morning string sname =new("good morning
new
new   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <...="submit"><br><br><br> <table border="2">
Introduction to Struts 2
Introduction to Struts 2       This section provides you a quick introduction to Struts 2 framework. This section we are discussing the new features, struts 2 basics and architecture
Struts 2 version 2.3.16.3 released
Struts 2 version 2.3.16.3 released - Here is the latest maven dependencies code Latest version of Struts 2: Struts 2 version 2.3.16.3 released... for manipulating the Struts Intervals. So, application developed in Struts 2 should
Struts 2 Tutorial
Struts 2 Tutorial       RoseIndia Struts 2 Tutorial and Online free training helps you learn new elegant... 2 The new version Struts 2.0 is a combination of the Sturts action framework
Magicbox 2
Magicbox 2  how to build this? import java.util.*; class magicbox{ public static void main(String args[]){ Random r=new Random(); int[][] magic=new int[3][3]; int temp=r.nextInt(9)+1; boolean
Struts 2
Struts 2   I am just new to struts 2 and need to do the task. I have a requirement like this : when i click on link like Customer , this will display all the customers , address from a database table using jdbc and the screen
use is of 2
use is of 2  why we use 2 in "Integer.parseInt(str,2);" for binary to decimal conversion..??   ya i got it... because binary contain only two o and 1...so here use 2...same as octal has 8
Struts 2
Struts 2  we can extend DispatchAction class to implement a common session validation in struts 1.x. how to do the same in the struts2
Struts 2
Struts 2  I am getting the following error.pls help me out. The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has
New to struts2
New to struts2   Please let me know the link where to start for struts 2 beginners   Struts 2 Tutorials
Thunderbird 2
Information Organized Thunderbird 2 features many new enhancements to help...Thunderbird 2       Mozilla?s Thunderbird 2 email application is more powerful than ever. It?s now
Echo 2
Echo 2       Echo 2 allows you to code Ajax apps in pure Java (Demo)which automatically generates HTML and Javascript. Read full DescriptionADS_TO_REPLACE_1
FireFox 2
FireFox 2       The award... to do on the Web, and Firefox 2 is full of helpful features to make your... Add-ons that enhance Firefox. It?s easy to personalize Firefox 2
Web 2
Web 2.0 Introduction Web 2.0, a phrase is a cluster term for the new phase..., and an attempt to understand the rules for success on that new platform?. So Web 2.0 is a new way of business via Internet. It?s really a new business tactic
Web 2
computing. Though, it is not a new concept for the Internet, but in Web 2.0.... With the evolution of new century, the Web became much more interactive. It allowed... of Web 2.0 in 2004 in a conference claiming the new version of Web. It began
Web 2
applications The new feature included in the Web 2.0 based application in which... 2.0 technologies are new and evolving techniques for learning language, but new
Web 2
2.0 tools are endless even though we can say that the new generation of Internet
Web 2
. Descriptive list of Web 2.0 tools are endless even though we can say that the new
New to struts2.0
New to struts2.0  hi am new to struts2.0 in my application i have declared a list in static how to get the static list values in my result.jsp??? if i remove the static in the list the result is getting displayed.why
Struts 2 Tutorial
New to Java - New to java tutorial
. ADS_TO_REPLACE_1 Properties props = new Properties(); // code to fill props... = new Properties(); // code to fill props with any information Session... message = new MimeMessage(session) // set the content of message by setContent
What is Struts 2 framework
What is Struts 2 framework  Hi, I am new to the Java web programming. I have completed JSP, Servlet and HTML. Now I want to learn Struts 2. Tell me what is Struts 2? Thanks
zend framework 2
zend framework 2  i am new in zf2 and i want to develop a website in zf2 so can anyone help me to figure out the(login and signup page) with database
Struts 2 - Beganner
Struts 2 - Beganner  Hi ! I am new to Struts2 and I need clarification over Difference between Action Proxy and Action Mapper in struts2 and When both perform their activity?????? Many Thanks Venkateshlu
Maven 2 - Maven
Maven 2   Hi, I m new to Maven 2 and in process to implement Maven2. I have browse in the net and got my Maven 2 installed but now I m facing few concerns on creating a small project. Please help me in this regard Thanks
session maintain in struts 2
session maintain in struts 2  hi i am new to Struts 2..... in Action class i wrote **HttpSession session = request.getSession(); session.setAttribute("name", name1);** but in jsp class String session_name=(String
help me 2
help me 2  write java program to enter five numbers and will determine the location of the number sample output: ENTER 5 NUMBERS: 1 2 3 4...) { Scanner input=new Scanner(System.in); int array[]=new int[5
que 2 - Java Beginners
que 2  WAP to input a string & print out the text withthe uppercase... static void main(String[] args) { Scanner input=new Scanner(System.in... sb=new StringBuffer(); char ch[]=str.toCharArray(); for(int i=0;i
Pagination in struts 2
Pagination in struts 2  Hi, I have one question regarding pagination in struts 2 I saw one of your code that you explain here:- http... me or guide me what other option i have to use pagination in struts 2 without
Struts 2 + Ajax
Struts 2 + Ajax  hi , i am new in java ,i need a help I am setting the attribute in by session.setAttribute which is passes values to a jsp page, in which i have used display:column tag ,now the problem is that i have a attribute
JOptionPan 2 - Java3D
JOptionPan 2  A sentence can be thought of as one or more words which... ?A sentence is constructed with a series of words? Index 0 1 2 3... main(String args[]) { HomePage page = new HomePage
Moire Pattern 2 Java
Moire Pattern 2 Java   textWhat you are seeing in the screenshot... g2.setStroke(new BasicStroke(5)). Hint: A circle is just an oval whose width...; g2.setColor(Color.black);g2.fillOval(centerX, centerY - ovalWidth / 2, 300, ovalWidth
java code 1 of 2
java code 1 of 2  Create a washing machine class with methods...=new Scanner(System.in); public void switchOn...) { WashingMachine wm=new WashingMachine(); wm.switchOn(); int
GUI 2 - Java Beginners
GUI 2  How can I modify this code? Please give me a GUI...(); pane.setLayout(new FlowLayout()); numberLabel = new JLabel("Enter a number:");numberTextField = new JTextField(4);//calling
C++ Question 2
; } }; void main() { Triangle *tptr; Rectangle *rptr; Shape *sptr[2]; int i; tptr = new Triangle; rptr = new Rectangle; tptr->...; sptr[1] = rptr; for(i=0; i<2; i++) sptr[i]->displayArea
Struts 2 - Validation - Struts
Struts 2 - Validation annotations  digging for a simple struts 2 validation annotations example
regarding struts 2
regarding struts 2   is it not possible to get values from applicationresources.properties into our application in struts 2
struts 2 testing
struts 2 testing  can i get an example for struts 2 action class unit test
2's Complement
2's Complement  hi Can anyone plsss tell me the 2's complement java program... Thanks in advance
Where to learn Struts 2?
Where to learn Struts 2?  Hi, I am beginner in Struts and trying to find good tutorial to learn Struts 2 framework. My project is in Struts 2 and soon I have to work on the project. Let's know where to learn the Struts 2
Struts 2 Video Tutorial
Struts 2 Video Tutorial  I think its easy to learn from Struts 2 Video Tutorial. What is the url of Struts 2 Video Tutorial on roseindia.net website... your are right. You can learn Struts 2 very easily with the Struts 2 Video
Struts 2 online tutorial
Struts 2 online tutorial  Where to learn struts 2 online tutorial? Is there any good tutorials on roseindia.net for learning struts 2 online tutorial?   Yes, We have many tutorials for learning Struts 2 online through
Struts 2 + hibernate
Struts 2 + hibernate  How to integrate Struts 2 and Hibernate? Its urgent please help!!   See the example give below.. for integrating struts 2 and hibernate. Struts2.2.1 and hibernate integration application Integrate
Strurt 2 TLD - WebSevices
Strurt 2 TLD  pls any one can send me either link to download or actual TLD files of struts 2 i nead the TLD files but i could not found
struts 2 project samples
struts 2 project samples  please forward struts 2 sample projects like hotel management system. i've done with general login application and all. Ur answers are appreciated. Thanks in advance Raneesh
Struts 2 + Hibernate
Struts 2 + Hibernate  From where can i get good tutorial from integrating struts 2 with hibernate , which explains step by step procedure in integration and to build web applications

Ads