SCJP 5, OCPJP 7, 8, SCJD 5, SCWCD 4, SCBCD 5, SCJWS 4, IBM OOAD 833 & 834, MongoDB Developer
Prasad Saya wrote:So far what are you able to do? Are you seeing the list items in the select list ?
That Java code within JSP is mostly not allowed nowadays, and not a good programming practice.
SCJP 5, OCPJP 7, 8, SCJD 5, SCWCD 4, SCBCD 5, SCJWS 4, IBM OOAD 833 & 834, MongoDB Developer
Prasad Saya wrote:For the <select> tag there is an attribute named "onchange". Call a javascript function from "onchange" which will fill the textbox with the selected item in the list.
SCJP 5, OCPJP 7, 8, SCJD 5, SCWCD 4, SCBCD 5, SCJWS 4, IBM OOAD 833 & 834, MongoDB Developer
Prasad Saya wrote:No.
Do some google search about getting a value from a html select, etc.
SCJP 5, OCPJP 7, 8, SCJD 5, SCWCD 4, SCBCD 5, SCJWS 4, IBM OOAD 833 & 834, MongoDB Developer
Prasad Saya wrote:The code can be something like this:
SCJP 5, OCPJP 7, 8, SCJD 5, SCWCD 4, SCBCD 5, SCJWS 4, IBM OOAD 833 & 834, MongoDB Developer
Prasad Saya wrote:The javascript function's code can be like this:
One can get the selected item's index and the value and assign to the textfield.
Find the <select> list element by its id "items"
Get the list selected value based on the index
Find the <input> text element by its id
Assign/set the list selected value to the text element.
In case you have never used javascript you have to get familiar with it and write the code - there are lots of resources on the web if you lookup.
Dave Tolls wrote:Remember to always think in terms of what is on the server and what is available in the browser.
These are two different locations and, unless all the data is supplied to the browser on the initial response (ie all the values in the drop down as well as all their details) then the browser will have to make another request to the server when the user selects an option, in order to get that data.
That's where Ajax comes into it.
What's brown and sticky? ... a stick. Or a tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|