Displaying db retrieved values in JSP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jith87
    New Member
    • Jul 2007
    • 58

    Displaying db retrieved values in JSP

    Hi,

    I ve retrieved values from MySql db. From the result set i ve used the getXXX() to get the values in seperate variables. Earlier i used getParameter() to get the values from JSP page to be stored in db.

    Now i need to display the retrieved data in their corresponding controls such as textbox etc.. back in the JSP page....Can u help me out????


    Thanx in advance........
  • madhoriya22
    Contributor
    • Jul 2007
    • 251

    #2
    Originally posted by jith87
    Hi,

    I ve retrieved values from MySql db. From the result set i ve used the getXXX() to get the values in seperate variables. Earlier i used getParameter() to get the values from JSP page to be stored in db.

    Now i need to display the retrieved data in their corresponding controls such as textbox etc.. back in the JSP page....Can u help me out????


    Thanx in advance........
    Hi,
    You can use any Collection( such as Vector or ArrayList) to store the values retreived from database. Then use
    Code:
     
    request.setAttribute(String attributeName, Object object)
    to forward those values to to ur jsp page.

    Comment

    • jith87
      New Member
      • Jul 2007
      • 58

      #3
      Originally posted by madhoriya22
      Hi,
      You can use any Collection( such as Vector or ArrayList) to store the values retreived from database. Then use
      Code:
       
      request.setAttribute(String attributeName, Object object)
      to forward those values to to ur jsp page.
      I ve stored the values in seperate variables. How to re direct them to the JSP page.??? Also what do u mean by Object here???

      Comment

      • dmjpro
        Top Contributor
        • Jan 2007
        • 2476

        #4
        Originally posted by jith87
        Hi,

        I ve retrieved values from MySql db. From the result set i ve used the getXXX() to get the values in seperate variables. Earlier i used getParameter() to get the values from JSP page to be stored in db.

        Now i need to display the retrieved data in their corresponding controls such as textbox etc.. back in the JSP page....Can u help me out????


        Thanx in advance........
        You know the "Scriptlet" part of Jsp.

        Simply use this .

        Code:
        <%
        var1 = rs.getXXX(Y);
        %>
        <input type = "text" value = "<%=var1%>" name = "some_name" .... >
        Got me :-)

        Debasis Jana

        Comment

        • madhoriya22
          Contributor
          • Jul 2007
          • 251

          #5
          Originally posted by jith87
          I ve stored the values in seperate variables. How to re direct them to the JSP page.??? Also what do u mean by Object here???
          Hi,
          Object here could be ur collection object, it could be string .. etc. U should store those(which u hav stored in separate variables) values in Collection. Then it will be easy for you to pass those values to jsp. Have tried something ?

          Comment

          Working...