| | |
Combo box and Ms-access
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2007
Posts: 1
Reputation:
Solved Threads: 0
how can I extract all the values of one field from the database table (ex : all the names from the field NAME) and put them in a combo box in run time in the dynamically generated page…
and secondly, if all the values are available in the combo box, how can I select one value at a time from the combo box and store that value in a variable during run time…
and secondly, if all the values are available in the combo box, how can I select one value at a time from the combo box and store that value in a variable during run time…
•
•
Join Date: Feb 2007
Posts: 14
Reputation:
Solved Threads: 0
•
•
•
•
how can I extract all the values of one field from the database table (ex : all the names from the field NAME) and put them in a combo box in run time in the dynamically generated page…
and secondly, if all the values are available in the combo box, how can I select one value at a time from the combo box and store that value in a variable during run time…
hai..
I just give you the code for displaying and storing the values in the run time(part of code).
<%
//query for selecting the values from the database
pstmt1=con.createStatement();
rs=pstmt1.executeQuery("select * from test.emp");
%>
<!-- Displaying the values in the combo box -->
<form name="form1" method="post" action="">
<center>
<p>Select the Employee Id from the Combo box
<select name="eid" id="eid" onchange="filename.jsp">
<%
while(rs.next())
{
%>
<OPTION VALUE="<%=rs.getString("empid")%>"><%=rs.getString("empid")%></OPTION>
<%
}
%>
</select>
</p>
<p>
<input name="Submit" type="submit" id="submit" value="Submit">
</p>
</center>
</form>
<!-- Storing the value in the id variable during run time-->
<%
id=request.getParameter("eid");
%>
NEVER try to connect to database from JSP!
If you need data from DB use servlet and then pass them to your JSP...
If you need data from DB use servlet and then pass them to your JSP...
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
•
•
Join Date: Feb 2007
Posts: 14
Reputation:
Solved Threads: 0
•
•
•
•
NEVER try to connect to database from JSP!
If you need data from DB use servlet and then pass them to your JSP...
I am also beginner for Jsp.
Can you please tell me the reason(for not connecting the DB from JSP) so that i can understand the concept well.
Thanking you.
![]() |
Similar Threads
- query with combo box input (MS Access and FileMaker Pro)
- Perplexed: Combo Box Not Holding Data (C#)
- Want to use radio button or menu bar instead of combo box (Java)
- combo box (ASP)
- How do I limit text char in Combo box? (VB.NET)
- combo box help (VB.NET)
Other Threads in the JSP Forum
- Previous Thread: new to javascript
- Next Thread: how to get servers date
| Thread Tools | Search this Thread |
apache backbutton combobox connection database development directorystructure dynamicpagetitles eclipse frames glassfish ie8 imagetodatabse imageupload integer internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 network parameters passing ping printinserverinsteadofclient redirect request.getparameter response servlet servletdopost()readxml sessions software ssl state_saving_method stocks sun tomcat tutorial update video web






