弟兄们,,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中用呀!!!???
该怎么写才能对呀,,,