<script type="text/javascript">
 function nameAndPwd(){
   
   var username = document.getElementById("username").value;
   var password = document.getElementById("password").value;
   
   var url = "login_System.action?username="+username+"&password="+password;
   form.action = url;
   form.submit();
   
 }  
</script><form name="form" id="form" method="post" action="#">地址栏的效果:
http://localhost:8080/crm/login.action?username=admin&password=123怎样隐藏 谢谢了 最好能达到http://localhost:8080/crm

解决方案 »

  1.   

    js中加一行 
     var url = "login_System.action?username="+username+"&password="+password;
      form.action = url;
    form.method="post";
      form.submit();
      

  2.   


    <form action="<%=request.getContextPath() %>/loginAction.do" method="post">
    <fieldset><legend>manager login</legend>
    <table>
    <tr>
    <th><label>username:</label></th>
    <td><input name="username" type="text" /></td>
    </tr>
    <tr>
    <th><label>password:</label></th>
    <td><input name="password" type="password" /></td>
    </tr>
    <tr>
    <td><button type="submit" >Login</button></td>
    <td><button type="submit" >Cancel</button></td>
    </tr>
    </table>
    </fieldset>
    </form>这样提交整个form,action中用name来取相应的值就OK了
      

  3.   

    1.用form的post方式提交,地址栏不显示参数,如楼上做法
    2.用框架,地址栏不显示参数 frameset或iframe都可以
      

  4.   

    3.可以用ajax,这样同看不见参数
      

  5.   

    form 的post方式提交表单吧<script type="text/javascript">
     function nameAndPwd(){
     
      var url = "login_System.action;
      form.action = url;
      form.submit();
       
     }  
    </script><form name="form" id="form" method="post" action="#">其实这样就可以了,按楼主的方式其实是重复提交,只不过一个提交到get方法里,一个提交到post方法里了
      

  6.   

    另外如果楼主想达到http://localhost:8080/crm这种效果似乎框架是个不错的选择
      

  7.   

    整整服务器吧,apache整合tomcat服务器后,网址显示的是你想要显示的,完全可以屏蔽URL的参数。这是一些网站屏蔽url参数的一种方法。
      

  8.   


    其实是可以猜出来的,apache跟tomcat整合后配置一个url重写可以达到这种效果,不过比较麻烦
      

  9.   


    但是我做了form.method="post"; 把下面form的 method="post"去掉。还是不行!!!
      

  10.   

    用框架挺好!!!或者用form表单提交,post方式!这种也行
      

  11.   

    <script type="text/javascript">
     function nameAndPwd(){
        
      var username = document.getElementById("username").value;
      var password = document.getElementById("password").value;
        
      var url = "login_System.action?username="+username+"&password="+password;
      form.action = url;
      form.submit();
        
     }   
    </script>看来这种方式 参数无法隐藏 让我泪流满面
      

  12.   

    奇怪了,我的post就不会有问题啊。一般都是这样写的啊。
    不知道你有没有<input type="submit"/>这个控件,估计是你调用的有问题,重复提交了。<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title>New Web Project</title>
    <script type='text/javascript'>
    function testSubmit(){
    var url="test.jsp?uname=admin&upass=admin";
    var form=document.getElementById("myForm");
    form.action=url;
    form.submit();
    }
    </script>
        </head>
        <body>
            <form id="myForm" method="post">
             <input type="button" value="submit" onclick="testSubmit()">
            </form>
        </body>
    </html>