2013-03-22 3 views
2

select 태그에 응답을로드하는 데 문제가 있습니다. 첫 번째 상자를 기반으로 선택 상자를 변경하려고합니다.Struts 2에서 jQuery JSON 형식을 사용할 때 응답을 렌더링 할 수 없습니다

jQuery Ajax 태그가있는 Struts2를 사용하고 있습니다. 필요한 모든 항목이 있지만 응답은 옵션에 태그를 지정하지 않았지만 JS의 결과를 브라우저의보기 소스에서 볼 수 있습니다. 아래 코드는 내가 JSP 에서 작성한 코드는이

<div class="type-text"> 
    <s:url id="remoteurl" action="getGlobalManufacturerJquery.action?mainId=title&subId=Add Title&selectedManufacturer=strUser&gameFileID=%{gameFileID}&gameFileName=%{gameFileName}&titleName=%{titleName}&titleID=%{titleID}"/> 
       <sj:select 
        href="%{remoteurl}" 
        formIds="TitleGameHandsetsForm" 
        id="manufacturerName%{titleGameFilemappingID}" 
        onChangeTopics="reloadsecondlist" 
        name="manufacturerName%{titleGameFilemappingID}" 
        list="%{manufacturers}" 
        listKey="%{globalManufacturer}" 

        listValue="%{globalManufacturer}" 
        emptyOption="true" 
        headerKey="-1" 
        headerValue="Select Global Manufacturer" 
       /> 
      </div> 

그리고 아래가 첫 번째 값

<div class="type-text">   
       <s:url id="remoteurl" action="getGlobalModelJquery.action?mainId=title&subId=Add Title&selectedManufacturer=strUser&gameFileID=%{gameFileID}&gameFileName=%{gameFileName}&titleName=%{titleName}&titleID=%{titleID}"/> 
       <sj:select 

        id="globalModel%{titleGameFilemappingID}" 
        formIds="TitleGameHandsetsForm" 
        reloadTopics="reloadsecondlist" 
        name="modelFromSelect" 
        list="%{modelList}" 
        emptyOption="true" 
        headerKey="-1" 
        headerValue="Select Global Model" 
       /> 
       </div> 

들어간 상태에서 그리고 JSP에 있어야 내 두 번째 선택 상자 내 첫번째 선택 박스입니다 사용할 수있는 목록이 없습니다. 그러나 서버 코드는 gett입니다. js의 소스 코드에서 볼 수있는 결과를 보여 주며, 이것은 select 상자의 jsp에 추가 할 수 없습니다.

<select name="manufacturerName77" id="manufacturerName77"> 
<option value=""></option> 
</select> 
<script type='text/javascript'> 
jQuery(document).ready(function() { 
    var options_manufacturerName77 = {}; 
    options_manufacturerName77.datatype = "json"; 
    options_manufacturerName77.type = 'select'; 
    options_manufacturerName77.emptyoption = true; 
    options_manufacturerName77.headerkey = "-1"; 
    options_manufacturerName77.headervalue = "Select Global Manufacturer"; 
    **options_manufacturerName77.list = "[Acer, A Panda]";** 
    options_manufacturerName77.listkey = "Acer"; 
    options_manufacturerName77.listvalue = "Acer"; 
    options_manufacturerName77.jqueryaction = "select"; 
    options_manufacturerName77.id = "manufacturerName77"; 
    options_manufacturerName77.name = "manufacturerName77"; 
    options_manufacturerName77.oncha = "reloadsecondlist"; 
    options_manufacturerName77.href = "/ci/getGlobalManufacturerJquery.action"; 
    options_manufacturerName77.hrefparameter = "mainId=title&subId=Add Title&selectedManufacturer=strUser&gameFileID=3&gameFileName=dcdscd&titleName=Bubble boom chalenge&titleID=11"; 
    options_manufacturerName77.formids = "TitleGameHandsetsForm"; 


jQuery.struts2_jquery.bind(jQuery('#manufacturerName77'),options_manufacturerName77); 

}); 
</script> 
      </div> 
+0

struts에 대해별로 신경 쓰지 마십시오. – adeneo

답변

0

URL이 잘못 작성되면 목록에 대한 json 데이터를 반환해야하는 작업에 의해 아무것도 반환되지 않습니다. 당신은 같은 URL을 작성해야합니다

<s:url var="remoteurl" action="getGlobalManufacturerJquery"> 
    <s:param name="mainId" value="title"/> 
    <s:param name="subId" value="Add Title"/> 
    <s:param name="selectedManufacturer" value="strUser"/> 
    <s:param name="gameFileID" value="%{gameFileID}"/> 
    <s:param name="gameFileName" value="%{gameFileName}"/> 
    <s:param name="titleName" value="%{titleName}"/> 
    <s:param name="titleID" value="%{titleID}"/> 
</s:url> 
+0

안녕 고마워 회신 Roman.Even 수정 후 s : url 출력 변경되지 않았습니다. 다음은 html의 소스 코드입니다. – Krish

+0

두 번째 그리드를 다시로드하려면 'reloadTopics'를 제공해야합니다. –

+0

'reloadTopics'를 시도하기 전에 이름을 바꾸거나 더 나은 복사/붙여 넣기를 시도하십시오. –