jsp定义的方法里面能不能使用隐含对象?<%! public String a=null;
Connection con=null;
PreparedStatement stmt=null;
ResultSet r=null;
%>
<%request.setCharacterEncoding("GBK");
a=request.getParameter("bookname");%>
查询条件:<br>
<%=a%>
<%!
public void jspInit(){
try{
String driver="sun.jdbc.odbc.JdbcOdbcDriver";
String url="jdbc:odbc:bookstore";
String sql="select * from books where bookname like '%"+a+"%'"; /****我想在这里引用另外一个jsp页面的文本框bookname的参数,如果把a那里直接换成request.getParameter("bookname"),他又提示request 未定义,把request放在jspInit()方法外,又不知道怎么引用,请问这到底怎么搞才能引用bookname的参数
Class.forName(driver);
con=DriverManager.getConnection(url);
stmt=con.prepareStatement(sql);
}
catch(ClassNotFoundException e){
System.err.println("ClassNotFoundException"+e.getMessage());}
catch(SQLException e){
System.err.println("SQLExcption"+e.getMessage());}
}
%>
Connection con=null;
PreparedStatement stmt=null;
ResultSet r=null;
%>
<%request.setCharacterEncoding("GBK");
a=request.getParameter("bookname");%>
查询条件:<br>
<%=a%>
<%!
public void jspInit(){
try{
String driver="sun.jdbc.odbc.JdbcOdbcDriver";
String url="jdbc:odbc:bookstore";
String sql="select * from books where bookname like '%"+a+"%'"; /****我想在这里引用另外一个jsp页面的文本框bookname的参数,如果把a那里直接换成request.getParameter("bookname"),他又提示request 未定义,把request放在jspInit()方法外,又不知道怎么引用,请问这到底怎么搞才能引用bookname的参数
Class.forName(driver);
con=DriverManager.getConnection(url);
stmt=con.prepareStatement(sql);
}
catch(ClassNotFoundException e){
System.err.println("ClassNotFoundException"+e.getMessage());}
catch(SQLException e){
System.err.println("SQLExcption"+e.getMessage());}
}
%>
public void jspInit(HttpRequest request){