📄 userregister.jsp
字号:
<%@ page contentType="text/html;charset=GB2312" %><%@ page import="aa.Register" %> <%! //处理字符串的方法: 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 str=response.encodeURL("userRegister.jsp");%><P>输入您的信息,带*号项必须填写:<FORM action="<%=str%>" Method="post"><BR>登录名称<Input type=text name="logname">*<BR>真实姓名<Input type=text name="realname">*<BR>设置密码<Input type=pasword name="pasword">*<BR>电子邮件<Input type=text name="email">*<BR>联系电话<Input type=text name="phone">*<BR>通信地址<Input type=text name="address">*<BR><Input type=submit name="g" value="提交"></Form><jsp:useBean id="login" class="Register" scope="request" ></jsp:useBean> <% //提交信息后,进行注册操作: String logname="",realname="",pasword="",email="",phone="",address=""; if(!(session.isNew())) { logname=request.getParameter("logname"); if(logname==null) {logname=""; } logname=codeString(logname); realname=request.getParameter("realname"); if(realname==null) {realname=""; } realname=codeString(realname); pasword=request.getParameter("pasword"); if(pasword==null) {pasword=""; } pasword=codeString(pasword); email=request.getParameter("email"); if(email==null) {email=""; } email=codeString(email); phone=request.getParameter("phone"); if(phone==null) {phone=""; } phone=codeString(phone); address=request.getParameter("address"); if(address==null) {address=""; } address=codeString(address); } %> <% //为了以后处理汉字方便,我们采用了第1种方式初始化beans if(!(logname.equals(""))&&!(address.equals(""))&&!(phone.equals("")) &&!(realname.equals(""))&&!(pasword.equals(""))) {%> <jsp:setProperty name= "login" property="logname" value="<%=logname%>" /> <jsp:setProperty name= "login" property="realname" value="<%=realname%>" /> <jsp:setProperty name= "login" property="pasword" value="<%=pasword%>" /> <jsp:setProperty name= "login" property="email" value="<%=email%>" /> <jsp:setProperty name= "login" property="phone" value="<%=phone%>" /> <jsp:setProperty name= "login" property="address" value="<%=address%>" /> <% login.addItem(); } else {out.print("你还没有填写信息,或信息填写不完整"); } %> <% //返回注册信息 if(!(session.isNew())) { %> <jsp:getProperty name= "login" property="message" /> <% } %></Body></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -