找不到session符号无法通过编译
问题:找不到session符号无法通过编译
java源码
package com.mfl.DataConn;
import java.util.*;
import java.sql.ResultSet;
import com.mlf.Bean.LoginBean;//用于保存用户的bean
import java.sql.PreparedStatement;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpSession;
public class LoginDAOImple implements LoginDAO
{
DataConnection dc= new DataConnection();
LoginBean login=new LoginBean();
public ResultSet execute(String sql) throws Exception
{
return null;
// TODO 自动生成方法存根
}
public void insertInfo( ) throws Exception
{
Vector newcontent=(Vector)session.getAttribute("content");//问题出在这提法说找不到session符号无法通过编译
for(int i=0;i <newcontent.size();i++)
{
LoginBean login=(LoginBean)newcontent.elementAt(i);
}
System.out.println("执行insertInfo");
System.out.println("username of inserInfo "+login.username);
String sql="insert into userInfo (username,truename,pwd,pwd1,city,address,cardno,tel,email,cardtype) values( '"+login.username +" ', '"+login.truename +" ', '"+login.pwd+" ', '"+login.pwd1+" ', '"+login.city+" ', '"+login.address+" ', '"+login.cardno+" ', '"+login.tel+" ', '"+login.email+" ', '"+login.cardtype+" ')";
PreparedStatement pstmt=dc.getConnection().prepareStatement(sql);
System.out.println("执行execute");
ResultSet rs=pstmt.executeQuery();
}
}
jsp源码:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*"
errorPage="" % >
<%@ page import="com.mlf.Bean.LoginBean"% >
<%@ page import="com.mfl.DataConn.DAOFactory"% >
<%@ page import="java.util.*"% >
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd" >
<html >
<head >
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" >
<title >无标题文档 </title >
</head >
<body >
<form action="register_do.jsp" method="post" name ="form_checkout" >
<%
LoginBean login=new LoginBean();
Vector v= new Vector();
login.username=request.getParameter("username");
login.truename=request.getParameter("truename");
login.pwd=request.getParameter("pwd");
login.pwd1=request.getParameter("pwd1");
login.city=request.getParameter("city");
login.address=request.getParameter("address");
login.cardno=request.getParameter("cardno");
login.tel=request.getParameter("tel");
login.email=request.getParameter("email");
login.cardtype=request.getParameter("cardtype");
v.add(login);
session.setAttribute("content",v);
System.out.println("username "+login.username);
System.out.println("还没有进行注册");
DAOFactory.getLoginDAOInstance().insertInfo();
System.