• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

how to dispaly the selected value of a dropdown list

 
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi every body...

can you please suggest me how to display the selected value of a drop down list of a page...when we visit that page again.

actually i got some material on net but don't know how to use it.

the link i follwed was

webpage


i will just give you an examlple..


say my drop down list is



now say if i select UK from this.....and i visit this page next time it should show me the "UK" as the selected option

In the link which i followed ..they have used



but i don't know how to use it.

can any body help me.....is there any other way to get the result....what i have been using earlier was puuting all the options in an array...and then comparing the selected value with all the elements ...and whichever matches ..that option was put as selected.
but i want other way...please help .

 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Simply set the attribute selected="selected" on the option that you want.

That code you downloaded looks pretty useless as it uses a lot of proprietary classes that don't exist in the Servlet/JSP environment.
 
Sheriff
Posts: 28326
96
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:That code you downloaded looks pretty useless as it uses a lot of proprietary classes that don't exist in the Servlet/JSP environment.



Not surprising for a site named "dotnetspider.com", really. Reading a .Net forum for advice about Java programming isn't going to be particularly helpful.
 
rammie singh
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok fine....that's what i have been using...but i want to use the same way what is there on the link.....then how can i use it.....actually in my application there is such an requirement that i want to use the techique give on link page.

the link i reffered
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

rammie singh wrote:but i want to use the same way what is there on the link.....then how can i use it.....


Uh, switch to .NET?
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you want this in JSP??
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Rujuta gl", please check your private messages for an important administrative matter.
 
rammie singh
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yaah i want this in JSp only.....any help??
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

By using hidden variable,you can handle it.
 
rammie singh
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how can we handle it by hidden variable..can you show by a small example please...
and what if there are 7 -8 drop down list on the same page....in that case wil it be a good way to create so many hidden variables.
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not see how hidden variables help at all.

Again, all you need to do is to set the selected attribute properly. What's the issue?
 
Life just hasn't been the same since the volcano erupted and now the air is full of tiny ads.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic