aspose file tools*
The moose likes JSP and the fly likes Populating a value based on the option selected in the dropdown Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Populating a value based on the option selected in the dropdown" Watch "Populating a value based on the option selected in the dropdown" New topic
Author

Populating a value based on the option selected in the dropdown

anita prat
Greenhorn

Joined: Aug 11, 2011
Posts: 8
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?

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60992
    
  65

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.


  • [Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
    anita prat
    Greenhorn

    Joined: Aug 11, 2011
    Posts: 8
    The value that will be chosen by the end user after the page has been displayed in the browser.
    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 60992
        
      65

    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.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Populating a value based on the option selected in the dropdown