2010-04-01 77 views
0

選擇Onchage我打電話一個javascript使用struts1.2使服務器的呼叫,但它不是作出call.Please讓我知道我錯了,是代碼下面的JavaScript服務器問題

<html:form action="/populate"> 
    <html:select property="tName" onchange="test()">"> 
     <html:option value="">SELECT</html:option> 
     <html:options name="tList" /> 
    </html:select> 
</html:form> 

和stuts,配置有

<action path="/populate" name="tForm" type="com.testAction" validate="false" parameter="method" scope="request" > 
    <forward name="success" path="/failure.jsp" /> 
</action> 

和JavaScript是

function test(){ 
    var selObj = document.getElementById("tName"); 
    var selIndex = selObj.selectedIndex; 
    if (selIndex != 0) { 
     document.form[0].selIndex.action="/populate.do?method=execute&testing="+selIndex; 
     document.form[0].submit(); 
    } 
} 

回答

1

文件。 形式 - 複數。

+0

還不曾 – sarah 2010-04-01 05:34:16

0
document.forms[0].action="..."; // (don't need "selIndex" in there) 
+0

雅以其優良的,現在我越來越/填充不可用,即使映射是在有XML – sarah 2010-04-01 05:45:59

+0

你需要一個支柱的傢伙。 :-) – roufamatic 2010-04-01 05:58:00