⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userlogin.jsp

📁 2. 实现用户注册
💻 JSP
字号:

<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="aa.Login" %> 
<%! //处理字符串的方法:
  public String codeString(String s)
    { String str=s;
       try{byte b[]=str.getBytes("ISO-8859-1");
           str=new String(b);
           return str;
         }
      catch(Exception e)
         { return str;
         }
    }
%>
<HTML>
<BODY ><Font size=3>
<table align="center"border="0"width="740"height="18"bgcolor=greencell spacing="1">
<tr>
<td width="100%">
<a href="<%=response.encodeURL("http://localhost:8080/test/showBookList.jsp")%>">书目浏览</a>|
<a href="<%=response.encodeURL("http://localhost:8080/test/userRegister.jsp")%>">用户注册</a>|
<a href="<%=response.encodeURL("http://localhost:8080/test/userLogin.jsp")%>">用户登陆 </a>|
<a href="<%=response.encodeURL("http://localhost:8080/test/buybook.jsp")%>">订购图书 </a>|
<a href="<%=response.encodeURL("http://localhost:8080/test/modifyForm.jsp")%>">修改定单 </a>|
<a href="<%=response.encodeURL("http://localhost:8080/test/showOrderForm.jsp")%>">查看定单 </a>|
<a href="<%=response.encodeURL("http://localhost:8080/test/modifyPassword.jsp")%>">修改密码 </a>|
<a href="<%=response.encodeURL("http://localhost:8080/test/modifyMessage.jsp")%>">修改个人信息 </a></td>
</tr></table>
<Font size=3>
<%String string=response.encodeURL("userLogin.jsp");
%>
<P>输入用户名和密码:
<FORM action="<%=string%>" Method="post">
<BR>登录名称<Input type=text name="logname">
<BR>输入密码<Input type=pasword name="pasword">
<BR><Input type=submit name="g" value="提交">
</Form>
<jsp:useBean id="login" class="Login" scope="session" >
</jsp:useBean>
 <% //提交信息后,验证信息是否正确:
   String  message="",
           logname="",
           pasword="";
    if(!(session.isNew()))
    {logname=request.getParameter("logname");
        if(logname==null)
           {logname="";
           }
     logname=codeString(logname);
     pasword=request.getParameter("pasword");
        if(pasword==null)
           {pasword="";
           }
     pasword=codeString(pasword);
   }
 %>
 <%
   if(!(logname.equals("")))
    {
   %>
     <jsp:setProperty  name= "login"  property="logname"  value="<%=logname%>" />
     <jsp:setProperty  name= "login"  property="pasword"  value="<%=pasword%>" />
   <%
     message=login.getMessage();
        if(message==null)
          {message="";
          }  
   }
 %>
 <%  if(!(session.isNew()))
      { if(message.equals("ok"))
          { String str=response.encodeURL("buybook.jsp");
            response.sendRedirect(str); 
          }
        else
          {out.print(message);
          }
      }
  %>
</Body>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -