标题:弟兄们,,JSP问题,,好急呀!!~~~
取消只看楼主
davei
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2004-12-30
 问题点数:0 回复次数:1 
弟兄们,,JSP问题,,好急呀!!~~~
<%@ page contentType="text/html;charset=gb2312" import="sjk.DBSQL,java.sql.*"%>
<%response.setHeader("Pragma","No-cache"); response.setDateHeader("Expires",0); response.setHeader("Cache-control","no-cache"); %>
<%!
public String chanstr(String str){
      String temp_p=str, temp=null;
try{
       byte[] temp_c=temp_p.getBytes("ISO8859-1");
       temp=new String(temp_c);
}
       catch(Exception ex)
 {
 }
      return temp;
}
%>
<%
String zhibiao=chanstr(request.getParameter("zhibiao"));
DBSQL db=new DBSQL();
   db.openDB();
   String strSQL;
   strSQL="select Indicator_id,Indicator_name_cn from indicator where Indicator_Name_cn='" + zhibiao +"'";
  try {
      ResultSet sqlRst = db.executeQuery(strSQL);
      String ttt="";
      if (sqlRst.next()) {
          ttt=sqlRst.getString("Indicator_Name_cn");
         if (ttt!=null){
%>
           <script language=javascript>
                   alert(ttt);
                   location.href="index.jsp";
           </script><%}%>
<%}else{%>
          <script language=javascript>
                  alert('没有这个指标');
                  location.href="index.jsp";
         </script><%}
     sqlRst.close();
  } catch (SQLException ex) {
      System.err.println("aq.executeQuery: " + ex.getMessage());
   }
   db.closeDB();
%>

运行时,总是提示alter(ttt)中的ttt没有定义,是不是JSP中定义的ttt不能在JAVASCRIPT中用呀!!!???
该怎么写才能对呀,,,
搜索更多相关主题的帖子: 弟兄 JSP 
2005-03-10 20:59
davei
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2004-12-30
得分:0 
感谢回复,我是新手.以后请多指教~~!
2005-03-18 22:50



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-13144-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.055283 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved