单选框按钮,怎么接收页面传递过来的值,并选中啊

解决方案 »

  1.   

    纯JSP
    <%if(request.getAttribute("")==??){ %>
    选中 <input type="radio"  checked/>
    <%} %>
    还可以用标签不自带LZ用什么
      

  2.   

    可以再写详细点吗?<input type="radio" name="fruit" value = "app">苹果
    <input type="radio" name="fruit" value = "bra">香蕉
    <input type="radio" name="fruit" value = "org">橘子
      

  3.   

    你自己把form的method设置为get,然后看看传递就知道怎么传啦。
      

  4.   

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

  5.   


    <script>   
      function   getRadioValue(){   
         var   fruits=document.getElementsByName("fruit");   
         for(var   i=0;i<fruits.length;i++){   
            if(fruits[i].checked)   
                alert(fruits[i].value);   
         }   
      }   
      </script>
      

  6.   

    用JS,把上页checked的单选按钮的value当做参数传过来
      

  7.   

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

  8.   

    <input type="radio" name="fruit" value = "${参数}"  checked="${参数}"  />
    checked="true"或"checked"就是选中 false就是不选中
      

  9.   

    不会吧,LZ的意思是在findPW.jsp用request.getParameter("loginType") 取不到值?
    我觉得不应该,你在原页面alert看看原页面中取到了吗
      

  10.   

    原页面我用alert(document.LoginForm2.logType.value);测试了一下,发现原页面得到的值是undefined,那我不明白了 为什么document.LoginForm2.logType.value这句话取不到单选按钮的值呢?
      

  11.   

    req.getParameter("name");然后判断它等于什么 不就可以执行相应的语句了~~