2013-07-20 3 views
1

TopicName을 가져옵니다. 내 드롭 다운 상자에서 컨트롤러의 topicList 배열을 통해 드롭 다운으로 표시하고 있습니다. 내가 원하는 것은 선택된 드롭 다운 값으로 되돌려 보내는 동안 topicId (topicList 배열에 저장 됨)를 내 컨트롤러 throgh javascript 함수에 보내려는 것입니다. 여기 내 HTML 코드가 있습니다. 선택 주제 : 여기 컨트롤러로 선택한 드롭 다운의 다이나믹 값

 <td> 
      <select name="Topic" id="Topic" class="myDropDown"> 
        <option selected="selected" value="-1">-- Select Topic --</option> 

         <c:forEach var="item" items="${topicList}"> 
         <option >${item.topicName} </option> 
         //Here I want to send the value of item.topicId`enter code here` 
         </c:forEach> 
      </select> 

     </td> 

메신저를 통해 내 자바 스크립트 함수 내 값을 보내는 기능 doAddTopic() item.topicName 선택에 내가 값을 보낼에 {

      var subName=jq("#Topic option:selected").val(); 
         // alert(name);aaaaaaaaaaaaaaaaaaaaaaaaaaaaa 

        var url = "/xyz/abc/"+subName+"/"; 
         jq.post(url, function(data) 
         } 

내가 원하는 것은 item.topicId 중 하나입니다. 내가 할 수있는 어떻게이

답변

0

당신이

<c:forEach var="item" items="${topicList}"> 
         <option value="${item.topicId}">${item.topicName} </option> 
         //Here I want to send the value of item.topicId`enter code here` 
         </c:forEach> 

가지 적어 값 옵션 value="${item.topicId}"

+0

감사의 작업 내에서,이 같은 시도해야 할 수 있음 –

관련 문제