• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

How set Category value to dropdownlist  RSS feed

Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to set value 'Catogory id' from my subcatogory database.
I have save cid(Catogory id) in subcatogory database. When I want
update a data then i display Category name in Dropdownlist and subcategory
name in input(textbox). But problem is that i have use javascript to
set value in dropdownlist.So user can understand what he had saved previous
data and now he want to update data, means he want reselect another catgory name
from dropdownlist.

e.g. 1-cid 'ABC'-category name. i want just fill up dropdownlist from database
and display a user what he had selected previous and now he can change that
catgory name and reselect new category name.(how search cid id in category
dropdownlist and display category name using javascript)

Could i know why not my javascript is showing that value which i have set in
hidden field. means hidden field of text must match with dropdownlist and use
can see what he had selected previous category name.

Or otherway to set value in dropddownlist..

thanks for appreciate..

Posts: 1210
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chandrashekhar,

In future, please enclose your code snippets inside code tags. It improves readability of your post. Go through http://www.coderanch.com/how-to/java/UseCodeTags to learn how to use them.

I'll move this to the JSP forum since the solution lies in JSP and javascript, not databases.
Posts: 11604
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chandrashekhar Patil,

Chandrashekhar Patil wrote:Or otherway to set value in dropddownlist..

You should not use Java code in your JSP. Definitely have a read of this article and this one.

Another valuable tip: you don't seem to close your database resources (connection, statement, resultset) once you are done, so you have resource leaks as well in your code.

Hope it helps!
Kind regards,
Whatever. Here's a tiny ad:
how do I do my own kindle-like thing - without amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!