aspose file tools*
The moose likes JSP and the fly likes in dropdown problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "in dropdown problem" Watch "in dropdown problem" New topic
Author

in dropdown problem

Aravind Prasad
Ranch Hand

Joined: Dec 28, 2005
Posts: 263
Hello Ranchers

I'm doing a program in jsp-oracle.. and when a jsp page is called the combo box in that page has to display a particular field in the database
now.. in my program i can see the fields in the drop down..
the problem comes next
the combobox now have the employee ids (100 nos)
so when ever i click one from the combo
i want to get the emp name, and details in the text box..

for that can i call another query for that
or can i do that using java scripts

please help me ranchers
Jherald Lacambra
Ranch Hand

Joined: Feb 02, 2005
Posts: 129
can you elaborate your question


jherald
Aravind Prasad
Ranch Hand

Joined: Dec 28, 2005
Posts: 263
hello!!
my question is this
i'm doing a project in jsp - oracle using the webserver tomcat.. ok

now the module i'm developing is salary details of the employees
for that in the page there is one combo box and three text boxes

combo box referes to employee id
text box1 refers to employee name
text box2 refers to employee details
text box3 refers to salary

in the combo box i've connected it to the database oracle
so when the page is loading it will shows all the 100 employee id
when we select any one from the combobox the details corresponding to the employee number should display in the text boxes

for egs:
if i select the employee number : 45
name = Aravind Prasad
details = Project student
salary = 5000

like wise

for getting the values in the combo box i use the jdbc connection
the query is like this
select * from table1;
while (rs.next())
{ String name = rs.getString(1);
%>
<option><%=namme%></option>
<%
}
but for onChange() function in combo box i've to use java scripts

so again in inside the function
do i want to write the whole jdbc code..

please help me ranchers


Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

You should not do all the DB stuff in the JSP view.
Do it in a module controlled by a servlet.
Set all the necessary information into a bean, and use it in the jsp view.


[My Blog]
All roads lead to JavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: in dropdown problem