标题:我这个JPS程序运行的时候弹出一个错误
只看楼主
jerry1015
Rank: 1
等 级:新手上路
帖 子:39
专家分:0
注 册:2007-1-4
 问题点数:0 回复次数:7 
我这个JPS程序运行的时候弹出一个错误
我写了一登录验证的程序,第一个是保存为login.html
<html>
<head>
<title>A simple login Page</title>
</head>
<body>
<p>Please Login
<form action=login.jsp method=post>
<p>user name:<input type=text name=usenameField>
<p>password:<input type=text name=passwordField>
<p><input type=submit value=submit>
</form>
</body>
</html>
第二个保存为login.jsp
<
html>
<head>
<title>A simple JSP That verifies Password Policy</title>
</head>
<body>
<%! final static int MIN_PSWD_LEN=8;
boolen verifyPasswordLength(String password){
if(password.length()<MIN_PSWD_LEN)return false;
return true;}
boolen verifyPasswordHasDigit(String password){
for(int i=0;i<password.length();i++)
if(Character.isDigit(password.CharAt(i))) return true;
return false;}
boolen verifyPasswordPolicy(String password){
if(verifyPasswordLength(password)&&verifyPasswordHasDigit(password))
return true;
return false;
}
%>
<% String password=request.getParameter("passwordField");
if(verifyPasswordPolicy(password)){%>
<p> thankyou
<p>Your password meets the security policy
<%}else{%>
<p>Sorry
<p>Your password does not meet the security policy
<p><A haef="login.html">Please try again</a>
<%}%>
</body>
</html>
但是我登录login.html输入用户名和密码之后弹出了

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: Unable to compile class for JSP

An error occurred at line: 6 in the jsp file: /login.jsp

Generated servlet error:
    [javac] Compiling 1 source file

D:\Tomcat 5.0\work\Catalina\localhost\myapp\org\apache\jsp\login_jsp.java:11: ?????
??? ? boolen
??? ? org.apache.jsp.login_jsp
    boolen verifyPasswordLength(String password){
    ^



An error occurred at line: 6 in the jsp file: /login.jsp

Generated servlet error:
D:\Tomcat 5.0\work\Catalina\localhost\myapp\org\apache\jsp\login_jsp.java:14: ?????
??? ? boolen
??? ? org.apache.jsp.login_jsp
    boolen verifyPasswordHasDigit(String password){
    ^



An error occurred at line: 6 in the jsp file: /login.jsp

Generated servlet error:
D:\Tomcat 5.0\work\Catalina\localhost\myapp\org\apache\jsp\login_jsp.java:18: ?????
??? ? boolen
??? ? org.apache.jsp.login_jsp
    boolen verifyPasswordPolicy(String password){
    ^



An error occurred at line: 6 in the jsp file: /login.jsp

Generated servlet error:
D:\Tomcat 5.0\work\Catalina\localhost\myapp\org\apache\jsp\login_jsp.java:16: ?????
??? ?? CharAt(int)
??? ? java.lang.String
     if(Character.isDigit(password.CharAt(i))) return true;
                                  ^
4 ??


    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
    org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:553)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

我不知道是怎么回事啊.哪为大哥教教我
搜索更多相关主题的帖子: login JPS input name 
2007-08-21 17:07
醉卧千山
Rank: 1
等 级:新手上路
帖 子:100
专家分:0
注 册:2007-4-15
得分:0 
你是直接把html改为jsp文件的么
html改为jsp时需要把JSP的代码加上去的
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
加上<html>标记上面即可
你加了么?

天无绝人之路!
2007-08-21 21:54
无缘今生
Rank: 2
等 级:新手上路
威 望:3
帖 子:523
专家分:7
注 册:2007-6-25
得分:0 
把login.jsp文件中第6行的感叹号去掉试试?

时不再来!!!
2007-08-21 23:32
sea7
Rank: 2
等 级:新手上路
威 望:3
帖 子:291
专家分:0
注 册:2007-2-17
得分:0 
[QUOTE]
html>
<head>
<title>A simple JSP That verifies Password Policy</title>
</head>
<body>
<%! final static int MIN_PSWD_LEN=8;
boolen verifyPasswordLength(String password){
if(password.length()<MIN_PSWD_LEN)return false;
return true;}
boolen verifyPasswordHasDigit(String password){ //应该是boolean
for(int i=0;i<password.length();i++)
if(Character.isDigit(password.CharAt(i))) return true;
return false;}
boolen verifyPasswordPolicy(String password){
if(verifyPasswordLength(password)&&verifyPasswordHasDigit(password))
return true;
return false;
}
%>
<% String password=request.getParameter("passwordField");
if(verifyPasswordPolicy(password)){%>
<p> thankyou
<p>Your password meets the security policy
<%}else{%>
<p>Sorry
<p>Your password does not meet the security policy
<p><A haef="login.html">Please try again</a>
<%}%>
</body>
</html>[/QUOTE]
注意看出错提示!!!!

软件是一种修养
2007-08-22 08:11
susan001983
Rank: 1
等 级:新手上路
威 望:1
帖 子:125
专家分:0
注 册:2007-7-25
得分:0 
你那11行的for循环没写大括号吧?

2007-08-22 09:27
sea7
Rank: 2
等 级:新手上路
威 望:3
帖 子:291
专家分:0
注 册:2007-2-17
得分:0 
楼上的小妹妹,那里本来就不该有大括号

软件是一种修养
2007-08-22 11:00
支离破碎
Rank: 6Rank: 6
等 级:贵宾
威 望:23
帖 子:737
专家分:0
注 册:2007-1-4
得分:0 
boolen verifyPasswordLength(String password){

人生漂泊無依,有如浮萍菱花,隨水飄流,你会在我这里停留吗?
[url=http://51mynet.]http://51mynet.[/url]
2007-08-22 22:09
jerry1015
Rank: 1
等 级:新手上路
帖 子:39
专家分:0
注 册:2007-1-4
得分:0 
我已经搞定了.是有几个大小写的问题
2007-08-24 13:58



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-164388-1-1.html




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

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