| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1252 人关注过本帖
标题:jsp中的问题?
取消只看楼主 加入收藏
yubaojian0616
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2004-10-2
收藏
 问题点数:0 回复次数:1 
jsp中的问题?

这是注册面

<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*,java.util.*" errorPage="" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%! String m;%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>注册</title> <style type="text/css"> <!-- body,td,th { color: #99CCCC; } body { background-color: #999999; } .style2 {font-size: 18px} .style3 {font-size: 16px} .ziti { font-size: 18px; font-style: normal; line-height: normal; font-weight: bold; font-variant: normal; text-transform: none; color: #99CCCC; } .style4 {font-size: 20px} --> </style></head>

<body> <br> <br> <br> <br> <table width="478" border="0" align="center"> <tr> <td width="472"><span class="style4">请输入您的个人信息(标注'*'的内容必须填写)</span></td> </tr> </table> <form name="form1" method="post" action="register_confirm.jsp"> <table width="450" border="0" align="center"> <tr> <td width="130"><div align="center" class="style2">登陆名:</div></td> <td width="310"><input name="name" type="text" id="name"> *</td> </tr> <tr> <td><div align="center" class="style2">密码:</div></td> <td><input name="password" type="password" id="password"> *</td> </tr> <tr> <td><div align="center"><span class="style3">密码确认</span>:</div></td> <td><input name="password2" type="password" id="password2"> *</td> </tr> <tr> <td><div align="center" class="style2">电话号码:</div></td> <td><input name="telephone" type="text" id="telephone"> *</td> </tr> <tr> <td><div align="center" class="style2">Email:</div></td> <td><input name="email" type="text" id="email"> *</td> </tr> <tr> <td><div align="center" class="style2">您的住址:</div></td> <td><input name="address" type="text" id="address"></td> </tr> <tr> <td height="9"><div align="center" class="style2"></div> <div align="center" class="style2">验证码:</div></td> <td height="9"><input name="yanzhengma " type="text" id="yanzhengma "> *(验证码是: <% Random ran=new Random(); int a=ran.nextInt(9); int b=ran.nextInt(9); int c=ran.nextInt(9); int d=ran.nextInt(9);

m=new String(); String m1=String.valueOf(a); String m2=String.valueOf(b); String m3=String.valueOf(c); String m4=String.valueOf(d); m=m1+m2+m3+m4; session.setAttribute("m",new String(m)); out.print(m); %>)</td> </tr> <tr> <td height="3" colspan="2">            </td> </tr> <tr> <td height="4" colspan="2">            <input type="submit" name="Submit" value="立即注册!"></td> </tr> </table> </form> <br> <br> <br> <div align="center"><br> </div> </body> </html>

这是 验证面

<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*,wangshangshudian.*" errorPage="" %> <jsp:useBean id="sql" scope="request" class="wangshangshudian.sqlBean"/> <!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> <style type="text/css"> <!-- .style1 {font-size: 24px} body { background-color: #999966; } --> </style> </head>

<% String errMsg="",name=request.getParameter("name").trim(); String password=request.getParameter("password").trim(); String password2=request.getParameter("password2").trim(); String telephone=request.getParameter("telephone").trim(); String email=request.getParameter("email").trim(); String address=request.getParameter("address").trim(); String yanzhengma=request.getParameter("yanzhengma").trim(); if(name.length()==0) errMsg +="(用户名不能为空)<br>"; if(password.equals(password2)) errMsg +="(两次密码输入不一致)<br>"; if(password.length()==0) errMsg +="(密码不能为空)<br>"; if(telephone.length()==0) errMsg +="(必须填入电话)<br>"; try { int i=Integer.parseInt(telephone); }catch(Exception e) { errMsg +="(您输入的电话不合法)<br>"; } /* String m1=request.getParameter("m"); if(m.equals(yanzhengma)) errMsg+="(验证码不正确)<br>";*/ name=new String(name.getBytes("8859_1"),"gb2312"); try{ ResultSet rs; rs=sql.executeQuery("jdbc:odbc:customer_info","select * from customer_info where (name='"+name+"')"); if(rs.next()) { rs.close(); session.putValue("register_message","该用户名已被注册"); %> <jsp:forward page="register.jsp" /> <% } else { rs.close(); } }catch(Exception e) { out.print(e.getMessage()); } if(errMsg!="") { %> <jsp:forward page="dateError.jsp"> <jsp:param name="errMsg" value='<%=errMsg%>'/> </jsp:forward> <% } %> <body> <div align="center"> <p> <font size="7" face="Arial, Helvetica, sans-serif"> 亲爱的<%=name%>,请查看您的注册信息</font><br> <br> <br> </p> <form name="form1" method="post" action=""> <table width="450" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="137" height="30"><span class="style1">您的用户名:</span></td> <td width="313"><%=name%></td> </tr> <tr> <td height="30"><span class="style1">密码:</span></td> <td height="30"><span class="style1">(不显示)</span></td> </tr> <tr> <td height="30"><span class="style1">电话号码:</span></td> <td height="30"><%=telephone%></td> </tr> <tr> <td height="30"><span class="style1">您的地址:</span></td> <td height="30"><%=address%></td> </tr> <tr> <td height="30"><span class="style1">您的E-mail:</span></td> <td height="30"><%=email%></td> </tr> <tr> <td height="30" colspan="2">         <input type="submit" name="Submit" value="提交注册">      <input type="submit" name="Submit2" value="返回修改" onClick="history.back()"></td> </tr> </table> </form> <p>&nbsp; </p> </div>

</body> </html>

这是错误面 数据库没问题 bean也没问题

HTTP Status 500 -


type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.NullPointerException
	org.apache.jsp.myjsp.register_005fconfirm_jsp._jspService(register_005fconfirm_jsp.java:77)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.


Apache Tomcat/5.0.27

怎么办啊

还有 怎么让我在验证是检查 验证号阿 ?????????????????

搜索更多相关主题的帖子: jsp 
2004-10-06 15:14
yubaojian0616
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2004-10-2
收藏
得分:0 

哦 是如何生成验证码

2004-10-08 18:44
快速回复:jsp中的问题?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.029045 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved