simply use ur current result set with querystring to forward the values to
next page.

On Mon, Jul 27, 2009 at 6:32 PM, prabu vaikundanarayanan <[email protected]
> wrote:

>
> hello every body this is my first post in this group i have the doubt
> regarding how the resultset in first page can access in seconnd page
> of jsp
>
>
> Here is first page code:
>
>
> <%...@page contentType="text/html" pageEncoding="UTF-8"%>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>   "http://www.w3.org/TR/html4/loose.dtd";>
>   <%...@page import="java.sql.*" %>
> <html>
>    <head>
>        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
>        <title>JSP Page</title>
>    </head>
>    <body>
>        <%
>
>        String use = request.getParameter("name");
>        String pas = request.getParameter("address");
>        String cid =request.getParameter("cid");
>        int a = Integer.parseInt(cid);
>
>
>        try {
>
>            Class.forName("com.mysql.jdbc.Driver");
>            String url = "jdbc:mysql://localhost:3306/chit";
>            Connection con = DriverManager.getConnection(url, "root",
> "root");
>            ResultSet rs = null;
>            PreparedStatement pstm = null;
>            pstm = con.prepareStatement("insert into
> scheme1(name,address,cid) values(?, ?,?)");
>            pstm.setString(1, use);
>            pstm.setString(2, pas);
>            pstm.setInt(3, a);
>             pstm.executeUpdate();
>
>               out.println("successfully added");
>
>
>               String Str ="Select * from scheme1";
>               pstm=con.prepareStatement(Str);
>               rs=pstm.executeQuery(Str);
>
>              %>
>
>
>
>        <%
>                    while (rs.next()){
>               %>
>
>
>
>
>
>
>              <%
>
>
>
>              }
>            }catch(Exception e)
>                    {
>                out.println("notadded" +e);
>
>                }
>
>
>        %>
>  </body>
> </html>
>
>
> i wanna to print the name ,address, cid in anothere page
>  i tried like this
> <%--
>    Document   : overall
>    Created on : Jul 27, 2009, 3:59:47 PM
>    Author     : prabu
> --%>
>
> <%...@page contentType="text/html" pageEncoding="UTF-8"%>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>   "http://www.w3.org/TR/html4/loose.dtd";>
>
>     <%...@page import="java.sql.*"%>
>
> <html>
>    <head>
>        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
>        <title>JSP Page</title>
>
>    </head>
>    <body>
>
>
> <center>
>
>                   <table border="1" cellspacing="0" cellpadding="0">
>
>
> <tr><td><b>CUSTOMER-ID</b></td><td><b>NAME</b></td><td><b>ADDRESS</b></td></tr>
>
>
>
>
>
> <TR>
>                   <TD><%=rs.getInt(3)%></TD>
>              *///here error is showing
>
>               <td><%=rs.getString("name")%>  </td>
>           <td><%=rs.getString("address")%></td>
>
>
>           </TR>
>  </table>
>                   </center>
>                   </body>
> </html>
>
> if i did this getString in same page means no error but different page
> its showing error
>
>
> Please help me in this issue how i execute my values in next page
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to