PLEASE HELP!!!!

I have a JSP that has five text boxes in the centre of the page. Each of the text boxes represent a field in my database table. The first box is actaully a select box (not a text box), that has a drop down menu with all the items in my first column in my table of the database which is a reference number.

What I want to do is to have it so that when I select an item from the drop down menu, the corresponding columns of the same row in my table show up in the other 4 text boxes.

Could someone please let me know how to go about doing this and if possible give some example code.

Thank you in advance!!!!

[638 byte] By [moined_mogul] at [2007-9-26 2:20:49]
# 1
please help....
moined_mogul at 2007-6-29 9:25:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Please help....
moined_mogul at 2007-6-29 9:25:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

you have to store all the fields in arrays and you can use Javascript to changes the values dynamically after the value of the dropdown changes

I have no code right now and am working on something else but this is the approch you could do

You could call the same page after the user changes the dropdown and then you could use getParameter to get the Id from the dropdown and query the database to populate the boxes

It is usually better to do this clien side

JavaDen at 2007-6-29 9:25:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

I have a tag like the one below in my JSP. I do not think I am using the correct tag. I want to be able to display a column from my table in the box and do not want to have the user input anyhting here. Would should the tage look like?

<TR>

<TD ALIGN="right"><B><B><div class="text">Author:</div></B></TD>

<TD><INPUT TYPE="TEXT" NAME="Author" SIZE="30"></TD>

</TR>

moined_mogul at 2007-6-29 9:25:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

Do something like this

<%@ page language="java" import="java.sql.*,java.lang.*" %>

wasabi

<table border="1" cellspacing="1" cellpadding="5">

<tr>

<td>

<select name="select">

<%--

--%>

<%

String driver = "sun.jdbc.odbc.JdbcOdbcDriver";

String url = "jdbc:odbc:ODBCDataSource";

String user = "User";

String password = "Password";

String sqlstatement ="SELECT id as CId, ClientName FROMt_Clients " +

"WHEREstatus = 'active'" +

"ANDadmin_account != 1" +

"ANDclient_list_flag = 1" +

"ORDER BYClientName";

Connection con;

Class.forName(driver);

con = DriverManager.getConnection(url, user, password);

Statement stmt = con.createStatement();

ResultSet rs = stmt.executeQuery(sqlstatement);

while (rs.next()) {

%>

<option value="<%=rs.getString("CId")%>"><%=rs.getString("ClientName")%></option>

<% } /* of while */ %>

</select>

</td>

</tr>

</table>

<%

stmt.close();

con.close();

%>

JavaDen at 2007-6-29 9:25:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

Do something like this

<%@ page language="java" import="java.sql.*,java.lang.*" %>

wasabi

<table border="1" cellspacing="1" cellpadding="5">

<tr>

<td>

<select name="select">

<%--

--%>

<%

String driver = "sun.jdbc.odbc.JdbcOdbcDriver";

String url = "jdbc:odbc:ODBCDataSource";

String user = "User";

String password = "Password";

String sqlstatement ="SELECT id as CId, ClientName FROMt_Clients " +

"WHEREstatus = 'active'" +

"ANDadmin_account != 1" +

"ANDclient_list_flag = 1" +

"ORDER BYClientName";

Connection con;

Class.forName(driver);

con = DriverManager.getConnection(url, user, password);

Statement stmt = con.createStatement();

ResultSet rs = stmt.executeQuery(sqlstatement);

while (rs.next()) {

%>

<option value="<%=rs.getString("CId")%>"><%=rs.getString("ClientName")%></option>

<% } /* of while */ %>

</select>

</td>

</tr>

</table>

<%

stmt.close();

con.close();

%>

JavaDen at 2007-6-29 9:25:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7

Do something like this

<%@ page language="java" import="java.sql.*,java.lang.*" %>

wasabi

<table border="1" cellspacing="1" cellpadding="5">

<tr>

<td>

<select name="select">

<%--

--%>

<%

String driver = "sun.jdbc.odbc.JdbcOdbcDriver";

String url = "jdbc:odbc:ODBCDataSource";

String user = "User";

String password = "Password";

String sqlstatement ="SELECT id as CId, ClientName FROMt_Clients " +

"WHEREstatus = 'active'" +

"ANDadmin_account != 1" +

"ANDclient_list_flag = 1" +

"ORDER BYClientName";

Connection con;

Class.forName(driver);

con = DriverManager.getConnection(url, user, password);

Statement stmt = con.createStatement();

ResultSet rs = stmt.executeQuery(sqlstatement);

while (rs.next()) {

%>

<option value="<%=rs.getString("CId")%>"><%=rs.getString("ClientName")%></option>

<% } /* of while */ %>

</select>

</td>

</tr>

</table>

<%

stmt.close();

con.close();

%>

JavaDen at 2007-6-29 9:25:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...