问题描述:
在A.JSP中有一个超级链接 <a href="b.jsp?teamid=1008">update</a>,点击以后跳转到B.JSP中.然后地址栏中显示 .../b.jsp?teamid=1008 .  在B.JSP中使用JSP语句
<%
    String tid = request.getParameter("teamid");
    if (tid == null)
        out.println("error");
%>问题:  我为什么取不到teamid的值呢?

解决方案 »

  1.   

    b.jsp还是B.jsp
    分大小写的,页面能够打开??
      

  2.   

    通过超级链接可以接受到数据吗?
    不需要在A.jsp中写出POST方法吗?
    还有tid == null好像没什么用吧 应该改为tid.equals("")
      

  3.   

    http://218.75.241.186/caiji/yk/a.jsp?teamid=1008
    试试,没问题
      

  4.   

    几位大哥的建议我都看了,没有适合我的.我把B.JSP的代码贴出来,大家看看.
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <%@ page import="java.sql.*" %>
    <jsp:useBean id="et" class="dbOperation.connSql" scope="page"></jsp:useBean><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Update Expert Team Infomation</title>
    </head>
    <body style="font-family: Arial; font-size: small; font-weight: bolder">
    <table width="778" align="center">
    <tr>
    <td background="images/fba_01.jpg" height="125"></td>
    </tr>
    <tr>
    <td background="images/etbg.jpg" height="50"></td>
    </tr>
    </table>
    <table width="778" align="center">
    <tr>
    <td align="left" style="border: ; color: blue; font-family: Arial; font-size: medium; font-weight: bold">Team Leader</td>
    </tr>
    </table><form name="frm1" action="AddExpertTeam.jsp" method="post">
    <input type="hidden" name="teamid" value="<%=request.getParameter("teamid") %>">
    <input type="hidden" name="update" value="1">
    <table width="600" align="center" style="border: 1 solid #0000a0">
    <%
    et.connectDB("brtc1","brtc","");
    String  tid = request.getParameter("teamid");
    if (tid == null)
    out.println("no team id");A.JSP中不是链接,写错了,是一个JAVASCRIPT的函数:代码如下:
    <%@ page language="java" contentType="text/html; charset=GB18030"
        pageEncoding="GB18030"%>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.util.*" %>
    <jsp:useBean id="prj" class="dbOperation.connSql" scope="page"/>
        
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=GB18030">
    <title>Update Project Infomation</title>
    </head>
    <script language="javascript">
    function upExp(id)
    {
    window.open("updateExpertTeam.jsp?teamid="+id,"UpdateExpertTeam","menubar,statusbar,location,scrollbar,resizable=yes");
    }
     function upStaff(id)
    {
    window.open("updateStaffTeam.jsp?teamid="+id,"UpdateStaffTeam","menubar,statusbar,location,scrollbar,resizable=yes");
    }
    </script>
      

  5.   

    LZ两个页面用的字符集不一样啊.
    都用GBK试试.
    String  tid =(String)request.getParameter("teamid");
      

  6.   

    谢谢 Netself ,原来是字符集不一样造成的.
      

  7.   

    你先在你的SCRIPT里看下有没有获取ID的值...如果没有的话说什么都没有用;另外把你的script放进<HEAD>里看看,最后再看看你的字符集,都换成GBK或GB2312很就没有这么写JSP了.也建议楼主用Struts框架或别的框架.
      

  8.   

    谢谢 SKer , 不好意思,结贴的时候没有看到你.希望不要介意  :)