• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Populating a value based on the option selected in the dropdown

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a jsp here I have a drop down list that contains the list of franchises. There is nother field franchise code on the jsp which will have the value populated based on the valkue in the drop down. These two are properties of a form bean Franchise which is available in the form bean associated with the jsp.
FranchiseVO bean has properties franchisename and franchisecode. THe names appear in the dropdown. Based on the franchisename selected , the value of the franchise code should get populated. How do I acheive this? Do I need to use a hidden parameter to pass to the javascript?

 
Sheriff
Posts: 67747
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
That depends what you mean by "selected". Do you mean:

  • The value that will be set as selected by the JSP -- and therefore known at page-generation time.
  • The value that will be chosen by the end user after the page has been displayed in the browser.
  •  
    anita prat
    Greenhorn
    Posts: 8
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    The value that will be chosen by the end user after the page has been displayed in the browser.
     
    Bear Bibeault
    Sheriff
    Posts: 67747
    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
    Well, by that time the JSP has been evaluated on the server and is long gone. So you'll need to handle the change event for the dropdown on the client using JavaScript.
     
    And then the flying monkeys attacked. My only defense was this tiny ad:
    a bit of art, as a gift, that will fit in a stocking
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic