页面代码<html:form action="tree.do?operate=doOrderTree" method="post">
<input type="button" value="调用js" onclick="sendUrl()"/>
<input type="submit" value="提交" />
</html:form>
以下是调用的jsfunction sendUrl()
{
document.forms[0].action="tree.do?operate=doOrderTree";
document.forms[0].submit();
}用第二个按钮直接提交表单可以正常到达我想要的action 但是第一个按钮调用同样action却是404各位高手麻烦帮我看下啊
<input type="button" value="调用js" onclick="sendUrl()"/>
<input type="submit" value="提交" />
</html:form>
以下是调用的jsfunction sendUrl()
{
document.forms[0].action="tree.do?operate=doOrderTree";
document.forms[0].submit();
}用第二个按钮直接提交表单可以正常到达我想要的action 但是第一个按钮调用同样action却是404各位高手麻烦帮我看下啊
这句什么意思
然后JS代码中直接:document.form1.submit();因为你的action
应该定义了路径,这样应该可以实现!
function sendUrl()
{
document.forms[0].action="tree.do?operate=doOrderTree";
alert(document.forms[0].action);
document.forms[0].submit();
}
我怀疑是路径错了,如果不行,就在js中的action中加项目名称。
document.forms[0].action="xxx/tree.do?operate=doOrderTree";
JS中需要写绝对路径....
因为<html:form action="tree.do?operate=doOrderTree" method="post"> 可以自动查找项目名
{
document.forms[0].action="/tree.do?operate=doOrderTree";
document.forms[0].submit();
}
or
先从Action 跳到这个页面,再进行提交,这样应该是可以的啦。