论文无忧网提供:计算机毕业论文范文|计算机毕业设计|计算机毕业论文
栏目导航 ASP JSP .NET VB6.0 JAVA VC VF DELPHI PB 计算机网络 计算机科学与技术 PHP 其他 代写论文
当前位置: 澳门大西洋城开户 > 计算机 > JSP >

A400206网上书店售书系统

       con.close(); copyright paper51.com

      } paper51.com

    catch(SQLException e)

http://snowings.com

      {message="你还没有注册,或该用户已经存在,请你更换一个名字"; copyright paper51.com

      } http://snowings.com

    }

paper51.com

}

http://snowings.com

(2)用户登录 userLogin.jsp: http://snowings.com

<%String string=response.encodeURL("userLogin.jsp"); 内容来自论文无忧网 snowings.com

%> copyright paper51.com

<H3>

内容来自论文无忧网 snowings.com

<P>输入用户名和密码: 内容来自snowings.com

<FORM action="<%=string%>" Method="post"> http://snowings.com

<BR>登录名称<Input type=text name="logname">

paper51.com

<BR>输入密码<Input type=password name="password">

内容来自snowings.com

<BR><Input type=submit name="g" value="提交"> http://snowings.com

</Form> 内容来自论文无忧网 snowings.com

<jsp:useBean id="login" class="book.Login"scope="session" > copyright paper51.com

</jsp:useBean>

copyright paper51.com

 <% //提交信息后,验证信息是否正确:

内容来自论文无忧网 snowings.com

   String  message="", http://snowings.com

          logname="", http://snowings.com

           password="";

内容来自论文无忧网 snowings.com

   if(!(session.isNew()))

内容来自论文无忧网 snowings.com

   {logname=request.getParameter("logname"); http://snowings.com

       if(logname==null) copyright paper51.com

          {logname="";

内容来自snowings.com

          }

copyright paper51.com

    logname=codeString(logname);

copyright paper51.com

    password=request.getParameter("password");

copyright paper51.com

       if(password==null)

paper51.com

          {password="";

内容来自论文无忧网 snowings.com

          }

copyright paper51.com

    password=codeString(password); copyright paper51.com

   } copyright paper51.com

 %> paper51.com

 <% 内容来自snowings.com

  if(!(logname.equals(""))) copyright paper51.com

    {

http://snowings.com

   %> 内容来自论文无忧网 snowings.com

    <jsp:setProperty  name="login" property="logname" value="<%=logname%>" />

内容来自snowings.com

    <jsp:setProperty  name="login"  property="password"  value="<%=password%>"/>

内容来自snowings.com

     <p> copyright paper51.com

        <% paper51.com

    message=login.getMessage(); paper51.com

       if(message==null) copyright paper51.com

         {message="";

paper51.com

         }  内容来自论文无忧网 snowings.com

   }

http://snowings.com

 %> 内容来自snowings.com

       <%  if(!(session.isNew()))

paper51.com

      {if(message.equals("ok"))

paper51.com

         { String str=response.encodeURL("buybook.jsp"); 内容来自论文无忧网 snowings.com

           response.sendRedirect(str); 内容来自snowings.com

         }

内容来自snowings.com

       else copyright paper51.com

         {out.print(message);

内容来自snowings.com

         }

内容来自论文无忧网 snowings.com

      }

内容来自snowings.com

  %>

paper51.com

本程序用了Bean: Login.java : 内容来自snowings.com

package book;

内容来自snowings.com

import java.sql.*; paper51.com

public class Login

paper51.com

{   String logname, 内容来自snowings.com

          realname,

http://snowings.com

          password, 内容来自论文无忧网 snowings.com

          phone, paper51.com

          address; 内容来自论文无忧网 snowings.com

    Stringsuccess="false",message=""; 内容来自论文无忧网 snowings.com

    Connection con;

copyright paper51.com

    Statement sql;

paper51.com

    ResultSet rs;

copyright paper51.com

    public Login()

paper51.com

    {  //加载桥接器: 内容来自论文无忧网 snowings.com

      try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

内容来自snowings.com

         } paper51.com

      catch(ClassNotFoundException e){} 内容来自论文无忧网 snowings.com

}

copyright paper51.com

//查询数据库的user表: 内容来自论文无忧网 snowings.com

   public String getMessage() 内容来自论文无忧网 snowings.com

    {try{

copyright paper51.com

        con=DriverManager.getConnection("jdbc:odbc:shop","",""); 内容来自snowings.com

        sql=con.createStatement(); copyright paper51.com

         String condition=

paper51.com

        "SELECT * FROM user WHERE logname ="+"'"+logname+"'"; copyright paper51.com

         rs=sql.executeQuery(condition); 内容来自论文无忧网 snowings.com

         int rowcount=0; 内容来自snowings.com

         String ps=null;

内容来自snowings.com

         while(rs.next()) paper51.com

          { rowcount++;

copyright paper51.com

            logname=rs.getString("logname");

copyright paper51.com

        System.in的话,就必须先做处理了。

内容来自论文无忧网 snowings.com

------分隔线----------------------------
联系方式