function upload(enterid){
// document.all('formname').method = "get";
document.all('formname').action="uploadsinglepic?enterid="+enterid;
alert(enterid);
document.all('formname').submit();
}
我在Struts2 action中System.out.println(enterid);
System.out.println(ServletActionContext.getRequest().getParameter("enterid"));
都无法获取enterid值?求帮助!!!

解决方案 »

  1.   

    不行,不能用 form 来提交带参数URL。你只能先在<form>中定义一个隐藏域:
      <input type="hidden" id="enterid" name="enterid">然后JS中:
    document.getElementById("enterid").value = enterid;
      

  2.   

    document.all('formname').method = "get"; 加上这样的也不行吗?
    为什么<a href></a> 这种方式却能Get
    是不是js 底层根本没有实现Get方式?
      

  3.   

    你要是get方式,根本不需要提交form,
    只有window.href或replace你的带?好的url就好了。
      

  4.   

    +1
    我一般用  window.location.href='xx.action';
    document.all() 有的浏览器不支持该属性
      

  5.   


    window.location.href='xx.action'; 这个方法如果是针对用了框架集的,好像不太好用!
      

  6.   


    如果想跳转顶级页面,可以用 top,类似:
      top.location = 'xx.action';但这样只能支持GET方式,URL传参。
      

  7.   

    document.myform.action="mexposure_approved.action?stateType=pmcApproved&id="+id+"&customerCode="+cusCode;
    document.myform.submit();
    这样是可以的,action里要有stateType属性的get\set方法