<a href="javascript:window.location.href='findPW.jsp?uname='+document.LoginForm2.username.value+'&loginType='+document.LoginForm2.logType.value">忘记密码? </a> 
新页面用request.getParameter("loginType") 取不到值啊

解决方案 »

  1.   

    <a href="#" onclick="xxx..your js here"> forgot pw?</a>
      

  2.   

    答:不可能啊。我用楼主的代码测试,一切正常啊
    网页cq.html<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <title>cq.html</title>

        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="this is my page">
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        
        <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->  </head>
      
      <body>
      <script type="text/javascript">
      
      </script>
        测试页面. <br>
       
        <a href="javascript:window.location.href='/web_chart/index.jsp?uname='+document.LoginForm2.username.value+'&loginType='+document.LoginForm2.logType.value">忘记密码? </a> 
         <form action="/web_chart/index.jsp" method="POST" name="LoginForm2">
       
    <input type="text" name="username"  value="jns"> 
    <input type="text" name="logType"  value="AAA"> 
        <input type="submit" value="提交" />
        </form>
      </body>
    </html>提交取值index.jsp<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        
        
        <title>测试</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 

    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
      </head>
      
      <body>
        输出结果是: <br>
        <% request.setCharacterEncoding("UTF-8"); %>
       
        uname:<%=request.getParameter("uname") %>
        loginType:<%=request.getParameter("loginType") %>
      </body>
    </html>
    运行时,正确取到值啊
      

  3.   

    document.LoginForm2.logType.value取不到值,很有可能是logType.value本身为空值,你可以打印出来验证一下是否有值。
      

  4.   

    一般这样做<a href="javascript:void(0);" onclick="xxxxx">XXX</a>
      

  5.   

    前面的uname 有值的话 后面要是没有值 只可能是你的 路径错了 或者本身那个值就是不存在的
      

  6.   

    首选,你这种方式写得不好,让人看到很累
    <a href="javascript:window.location.href='findPW.jsp?uname='+document.LoginForm2.username.value+'& amp;loginType='+document.LoginForm2.logType.value">忘记密码? </a>
    新页面用request.getParameter("loginType") 取不到值啊可以改成这种方式,更清晰
    <a href="javascript:findPass();">忘记密码</a>var findPass=function(){
      var username=document.LoginForm2.username.value;
      var logType=document.LoginForm2.logType.value;
      var url="findPW.jsp?uname="+escape(username)+"&logType="+escape(logType);
      window.open(url);
    }加上escape,是解决中文get方式乱码。
      

  7.   

    document.LoginForm2.logType.value必须放在JavaScript代码里才有用吧..