title: Username and Password in JSP after Successful registration
body: <p>How to show the Username and Password in the Page which I am displaying after successful Registration.</p>
  
  <p>The code I developed for Registration is as follows</p>
  
  <pre><code>&lt;%@page import="java.io.*,java.sql.*;" %&gt;
  &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
      &lt;title&gt;Halcyon Technologies Pvt. Ltd.&lt;/title&gt;
  &lt;/head&gt;
  &lt;body bgcolor="#D9EEFB"&gt;
      &lt;p
        &lt;% try
        {
         String Username;
         String Password;
         ResultSet rs;
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         Connection con=DriverManager.getConnection("jdbc:odbc:OnlineExam");
         Statement st=con.createStatement();
         Statement st2=con.createStatement();
         Statement st3=con.createStatement();
         String status="s";
         st2.executeUpdate("insert into Login values('"+request.getParameter("username")+"','"
                                                       +request.getParameter("password")+"','"
                                                       +status+"')");
         st.executeUpdate("insert into Details values('"+request.getParameter("username")+"','"
                                                        +request.getParameter("name")+"','"
                                                        +request.getParameter("gender")+"','"
                                                        +request.getParameter("sel_cat")+"')");
         if(request.getParameter("sel_cat").equals("Experienced"))
         {
                    st3.executeUpdate("insert into Experienced values('"+request.getParameter("username")+"','"+request.getParameter("expyears")+"','"+request.getParameter("company")+"','"+request.getParameter("designation")+"','"+request.getParameter("salary")+"','"+request.getParameter("comAddress")+"')");
         }
          String s1 = request.getParameter("username");
          String s2 = request.getParameter("password");
  
          session.setAttribute("s1", s1);
          session.setAttribute("s2", s2);
          rs = st.executeQuery("select Username, Password from Login where Username='" + s1 + "'");
  
         if (rs.next()) 
          {
              Username=rs.getString(1);
              Password=rs.getString(2);
              System.out.println(Username);
              System.out.println(Password);
          }
         st.close();
         st2.close();
         st3.close();
         }
  
         catch(Exception e)
                 {
             out.println(e);
                 }
  %&gt;
    &lt;font color="red" size="5"&gt; You have registered successfully!!!&lt;br&gt;&lt;/font&gt;
    &lt;font color="red" size="5"&gt; Username :  &lt;br&gt;&lt;/font&gt;
    &lt;font color="red" size="5"&gt; Password :  &lt;br&gt;&lt;/font&gt;
    &lt;p&gt;&lt;a href="Login.jsp"&gt;&lt;strong&gt;Go Forward&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I could able to get the Username and Password on console, but how to display them on JSP.</p>
  
  <p>The code here to display on console is </p>
  
  <pre><code>if (rs.next()) 
          {
              Username=rs.getString(1);
              Password=rs.getString(2);
              System.out.println(Username);
              System.out.println(Password);
          }
  </code></pre>
  
  <p>The code to display JSP is below. In this JSP i want to display Username and Password.</p>
  
  <pre><code> &lt;font color="red" size="5"&gt; You have registered successfully!!!&lt;br&gt;&lt;/font&gt;
    &lt;font color="red" size="5"&gt; Username :  &lt;br&gt;&lt;/font&gt;
    &lt;font color="red" size="5"&gt; Password :  &lt;br&gt;&lt;/font&gt;
    &lt;p&gt;&lt;a href="Login.jsp"&gt;&lt;strong&gt;Go Forward&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
  </code></pre>
  
  <p>How to code to display Username and Password in JSP?</p>