Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JSP and the fly likes Listbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Listbox " Watch "Listbox " New topic
Author

Listbox

rose hegde
Ranch Hand

Joined: Oct 22, 2003
Posts: 40
I have a popup window where user searches for a name from database and names starting with the alphabet will all be displayed in a listbox.
Than when the user clicks on employee name displayed in listbox all details pertaining to him should appear in the parent screen.
I can search and display employee names but than when i click the name for details of the employee to be displayed i get error.
So can anyone tell me how to do this?
Thanx
G Raghavan
Greenhorn

Joined: Aug 21, 2000
Posts: 15
What is the error that you get. if put the code it will be better.
I hope this suggesstion works. Put the employee name or ID which ever is unique in a session variable and pass it to the jsp page of the parent window.
regards,
Raghavan


G Raghavan
rose hegde
Ranch Hand

Joined: Oct 22, 2003
Posts: 40
Hi,
this is the java code i am pasting..
now in the table i have a unique field called sl_no and thats what i am passing..in the code i have hard coded and given value 1...but how to pass value of the user selected value from list box in front end..pls help...
public void empdisplayRecords()
{
try{
rs=sttnew.executeQuery("select * from dte_leave_transaction where sl_no = 1");
while (rs.next())
{
recemponly = new String[1][16];
if (rs.getInt(1)!=0)
{

for(int j=0;j<16;j++)
recemponly[0][j]=rs.getString(j+1);
}
}
}catch (Exception e )
{
System.out.println(e.getMessage());
}
public String getemprecordonly(int index1,int index2)
{
return recemponly[index1][index2];
}}
jyothsna kumari
Ranch Hand

Joined: Jul 21, 2003
Posts: 108
hai rose,
in a list box u can get the selected index which the user has choosed.as
"document.form.listbox.selectedIndex".from this selected index u get the corresponding id value and place it in a session variable and send to server.from there i think u can do the remaining work.
jyothsna
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Listbox
 
Similar Threads
Capturing a list of details from the UI to ActionForm
Selecting item in h:SelectOneMenu dynamically
Popup to parent communications
logic:iterate and onChange
checkbox in a dropdown/ListBox