I use Javascript in Struts,like follows: <script language="JavaScript"> function goURL(tmp){ alert(tmp); document.forms[0].action="/log.do?action="+eval(tmp); document.forms[0].submit(); } </script>
<html:form method="post" action="log.do"> <html:link page="/log.do?action=First">First Page</html:link> <html:select property="pageID" size="1" onchange="javascript:goURL( this.options[this.selectedIndex].value)"> <option value="0">First</option> <option value="1">Second</option> <option value="2">Third</option> </html:select> </html:form> when click "First Page",I can redirect my page to log.do page,but when I change the value of select,and call goURL,I find my page don't redirect to the log.do page,why? I am puzzled with it! Anybody can tell me how to redirect my page with Javascript under Struts? Thanks