RSS Forums RSS
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 4130 | Replies: 4
Reply
Join Date: Mar 2007
Posts: 1
Reputation: rittik is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
rittik rittik is offline Offline
Newbie Poster

Help Combo box and Ms-access

  #1  
Mar 18th, 2007
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…
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2007
Posts: 14
Reputation: Thendral is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Thendral Thendral is offline Offline
Newbie Poster

Re: Combo box and Ms-access

  #2  
Apr 2nd, 2007
Originally Posted by rittik View Post
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");
%>
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,658
Reputation: peter_budo is just really nice peter_budo is just really nice peter_budo is just really nice peter_budo is just really nice 
Rep Power: 12
Solved Threads: 311
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Combo box and Ms-access

  #3  
Apr 2nd, 2007
NEVER try to connect to database from 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, JAVAWUG (Java Web User Group), Coding the Architecture
Reply With Quote  
Join Date: Feb 2007
Posts: 14
Reputation: Thendral is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
Thendral Thendral is offline Offline
Newbie Poster

Re: Combo box and Ms-access

  #4  
Apr 2nd, 2007
Originally Posted by peter_budo View Post
NEVER try to connect to database from JSP!
If you need data from DB use servlet and then pass them to your JSP...


Hai..

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.
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,752
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 19
Solved Threads: 200
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Combo box and Ms-access

  #5  
Apr 2nd, 2007
JSP is a display technology, it is NOT meant to contain business logic.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 12:50 pm.
Newsletter Archive - Sitemap - Privacy Statement - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC