Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • 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 ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

How set Category value to dropdownlist

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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..

 
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • 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 https://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.
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • 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,
Roel
 
Amateurs built google. Professionals built the titanic. We can't find the guy that built this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!