Hi Sanjeev,

Try like this..

...//Ur query will be somewhere like here
...
out.println("<select name=station size=1>");
while(rs.next()){
out.println("<option value=rs.getInt(\"stnid\")>"+rs.getString("station"));
}

//here rs=resultset
...
...
if U do like this what U see is all the stations in Ur database, But if U submit
the form and if U get the value of station it is that unique number
corresponding to the selected  station.

Hope this helps if not write me soon.


lalith




At 05:23 AM 10/5/99 PDT, you wrote:
>Hi,
>I hv been developing a database access application using servlets.I hv one
>combobox populated with the data coming from SQL say "select stnid,station
>from station" thru JDBC.Now user selects a station from the combobox which
>shows only station name and not stnid. When I submit it I can get the value
>of station using req.getParameter(). I want to insert a record in a
>different table but the value to be inserted should be stnid and not
>station.
>One crude approach may be to again query the database and get stnid for the
>selected station.
>   But I am sure my friends out there may not like this approach. What
>should be the method of achieving it?
>Thanks
>Sanjeev Kumar
>
>______________________________________________________
>Get Your Private, Free Email at http://www.hotmail.com
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to