JSP에서 DropDown 목록 값을 읽는 방법을 알고 싶습니다. 아래는 나의 JSP 코드이다.JSP 페이지에서 Javascript를 사용하여 드롭 다운 값을 읽는 방법
<fieldset>
<s:form theme="simple" enctype="multipart/form-data" name="uploadDocument" method="POST" action="?">
<table>
<tr>
<td wrap>Select The Type of Letter to Upload:</td><td><s:select id="letters" list="letterList" name="ListofLetters" headerKey="-1" headerValue="--Select The Letter Type--"/></td>
<tr>
<td nowrap ><s:file name="userFile" label="userFile" size="25" id="upload" /></td>
<td class="button-blue"><s:submit action="Upload" value="Attach File" onclick=" return validateFile()"/></td>
</tr>
</table>
</s:form>
</fieldset>
목록은 데이터베이스에서 동적으로 채워집니다. 내가
document.getElementById('letters').value
을 사용할 때 그것은 나에게 내가 적절한 검사를 수행 할 수 있도록 각각의 키에 관련 지을 수 있었던 값을 얻을 수있는 방법 "0,1,2 등"과 같은 키 값을 반환하기 때문에. 사전에 감사합니다 :)이 현재 선택된 옵션의 텍스트를 얻을
"value"는 선택한 옵션의 텍스트를 의미합니다. –