2 Replies - 5320 Views - Last Post: 12 December 2013 - 04:32 AM

#1 sadbuddy   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 32
  • Joined: 18-November 12

How to retrieve data from database to the text fields jsp page

Posted 07 December 2013 - 07:57 AM

Hey guys ! I am facing problems of retrieving data from database to the text fields. A user selects an option from the drop down lists, which will caused the details related to the option to be displayed in the text fields. Below are my codes:
<select name="studID" style="width: 163px">
                <% ResultSet rsOption = null; %>
                <% studsDA studDA = new studsDA();
                   rsOption = studDA.initializeOption();
                   while(rsOption.next()){
                %>
                
                <% 
                   String title = rsOption.getString("StudentID");
                %>
                <option value="<%=id %>"><%=id %></option>  
                <%
                }
                %>
		</select>

               Student name : <input type = "text" value = "" id = "name" size = 30>
               Student age  : <input type = "text" value = "" id = "age" size = 30>


Currently, I am doing this in a jsp page. All the above codes is in a form tag. How can i retrieve data into the text fields and data is able to change according to what user selects in the drop down lists ?

Is This A Good Question/Topic? 0
  • +

Replies To: How to retrieve data from database to the text fields jsp page

#2 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6259
  • View blog
  • Posts: 24,028
  • Joined: 23-August 08

Re: How to retrieve data from database to the text fields jsp page

Posted 07 December 2013 - 10:15 AM

Moved to JavaEE
Was This Post Helpful? 0
  • +
  • -

#3 Fooality   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 12-December 13

Re: How to retrieve data from database to the text fields jsp page

Posted 12 December 2013 - 04:32 AM

Just generally, if you want some thing on the page to be filled with options as soon as a user selects an option, you have to use AJAX/javascript to do it. There's not enough info in your code to see what you want to do.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1