论文无忧网提供:计算机毕业论文范文|计算机毕业设计|计算机毕业论文
栏目导航 ASP JSP .NET VB6.0 JAVA VC VF DELPHI PB 计算机网络 计算机科学与技术 PHP 安卓APP 其他 C# 代写论文
当前位置: > 计算机 > JSP >

A400206网上书店售书系统

       con.close(); 内容来自www.paper51.com

      } copyright paper51.com

    catch(SQLException e)

内容来自www.paper51.com

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

      }

内容来自www.paper51.com

    }

paper51.com

} 内容来自www.paper51.com

(2)用户登录 userLogin.jsp:

内容来自论文无忧网 www.paper51.com

<%String string=response.encodeURL("userLogin.jsp");

内容来自www.paper51.com

%> http://www.paper51.com

<H3> paper51.com

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

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

<BR>登录名称<Input type=text name="logname"> 内容来自论文无忧网 www.paper51.com

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

paper51.com

<BR><Input type=submit name="g" value="提交"> 内容来自论文无忧网 www.paper51.com

</Form>

内容来自论文无忧网 www.paper51.com

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

内容来自www.paper51.com

</jsp:useBean>

http://www.paper51.com

 <% //提交信息后,验证信息是否正确: http://www.paper51.com

   String  message="",

copyright paper51.com

          logname="", http://www.paper51.com

           password=""; 内容来自论文无忧网 www.paper51.com

   if(!(session.isNew())) 内容来自www.paper51.com

   {logname=request.getParameter("logname");

内容来自论文无忧网 www.paper51.com

       if(logname==null)

copyright paper51.com

          {logname="";

http://www.paper51.com

          }

http://www.paper51.com

    logname=codeString(logname); copyright paper51.com

    password=request.getParameter("password"); paper51.com

       if(password==null)

copyright paper51.com

          {password="";

内容来自论文无忧网 www.paper51.com

          }

http://www.paper51.com

    password=codeString(password);

http://www.paper51.com

   }

内容来自www.paper51.com

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

 <%

paper51.com

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

    {

内容来自www.paper51.com

   %> 内容来自www.paper51.com

    <jsp:setProperty  name="login" property="logname" value="<%=logname%>" /> copyright paper51.com

    <jsp:setProperty  name="login"  property="password"  value="<%=password%>"/> 内容来自论文无忧网 www.paper51.com

     <p> copyright paper51.com

        <%

copyright paper51.com

    message=login.getMessage(); paper51.com

       if(message==null)

http://www.paper51.com

         {message="";

copyright paper51.com

         }  http://www.paper51.com

   }

paper51.com

 %>

内容来自论文无忧网 www.paper51.com

       <%  if(!(session.isNew())) 内容来自论文无忧网 www.paper51.com

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

内容来自www.paper51.com

         { String str=response.encodeURL("buybook.jsp"); paper51.com

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

         }

http://www.paper51.com

       else

copyright paper51.com

         {out.print(message); http://www.paper51.com

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

      } copyright paper51.com

  %> http://www.paper51.com

本程序用了Bean: Login.java : copyright paper51.com

package book; 内容来自论文无忧网 www.paper51.com

import java.sql.*; http://www.paper51.com

public class Login

copyright paper51.com

{   String logname, copyright paper51.com

          realname,

http://www.paper51.com

          password, http://www.paper51.com

          phone,

内容来自www.paper51.com

          address;

paper51.com

    Stringsuccess="false",message="";

内容来自www.paper51.com

    Connection con; http://www.paper51.com

    Statement sql;

内容来自论文无忧网 www.paper51.com

    ResultSet rs; 内容来自www.paper51.com

    public Login()

内容来自www.paper51.com

    {  //加载桥接器: paper51.com

      try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 内容来自www.paper51.com

         }

http://www.paper51.com

      catch(ClassNotFoundException e){}

copyright paper51.com

} copyright paper51.com

//查询数据库的user表:

http://www.paper51.com

   public String getMessage()

http://www.paper51.com

    {try{ 内容来自www.paper51.com

        con=DriverManager.getConnection("jdbc:odbc:shop","","");

http://www.paper51.com

        sql=con.createStatement(); http://www.paper51.com

         String condition=

内容来自论文无忧网 www.paper51.com

        "SELECT * FROM user WHERE logname ="+"'"+logname+"'"; http://www.paper51.com

         rs=sql.executeQuery(condition);

paper51.com

         int rowcount=0; 内容来自论文无忧网 www.paper51.com

         String ps=null;

copyright paper51.com

         while(rs.next())

内容来自论文无忧网 www.paper51.com

          { rowcount++; 内容来自www.paper51.com

            logname=rs.getString("logname");

内容来自论文无忧网 www.paper51.com

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

内容来自论文无忧网 www.paper51.com

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