每次运行页面时都会出现此错误:
org.apache.catalina.core.StandardWrapperValve在路径[/ hamza]的上下文中为servlet [jsp]调用GRAVE:Servlet.service()>抛出异常[Impossible de>编译器la classe pour la JSP]根本原因 java.lang.IllegalArgumentException:Page指令:导入的值无效
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>
<%@ page language="java" %>
<%@ page session="true" %>
<%@ page import="java.sql.*,java.io.*" %>
<% String login=(String)session.getAttribute( "login"); login=( session.getAttribute( "login")==null) ? "Null" : (String)session.getAttribute( "login"); %>
<% Blob photo=n ull; byte[ ] imgData=n ull ; Statement stmt=n ull; ResultSet rs=n ull; Connection theConnection=null ; try { Class.forName( "com.mysql.jdbc.Driver"); DriverManager.getConnection( "jdbc:mysql://localhost/pfe", "root", ""); stmt=t heConnection.createStatement();
rs=s tmt.executeQuery( "select photo from register where login = '"+login+ "'"); if (rs.next()) { photo=r s.getBlob(1); imgData=p hoto.getBytes(1,(int)photo.length()); } else { out.println( "Display Blob Example"); out.println(
"image not found for given login"); return; } // display the image response.setContentType( "photo/png"); OutputStream o=r esponse.getOutputStream(); o.write(imgData); o.flush(); o.close(); } catch (Exception e) { out.println( "Unable To Display image"); out.println(
"Image Display Error=" + e.getMessage()); return;} finally { try { rs.close(); stmt.close(); theConnection.close(); } catch (SQLException e) { e.printStackTrace(); } } %>