请高手帮我看一下代码??

qinjianhui 2003-03-25 10:48:56
<html>
<head>
<title>提交表单</title>
</head>
<body>
<%
//此段为函数区,先定义一个类
class check{
//检查输入是否为空
public Boolean isEmpty(String str){
str=str.trim();
if(str.length()==0)
return true;
else return false;
}
}
String name=request.getParameter("name");
check mycheck=new check();
%>
姓名:<%=name%>
<%
String str="";
String error="";
if(mycheck.isEmpty(name))
{
str="error ! name is empty!";
}
if(name.length()>50)
{
str="error! name is too long !";}
if(str.indexOf("error")!=-1)
{out.print(str);
error="a";
}
%>
</body>
</html>

我用的jswdk总是出错!不知道为什么?我是一个初学者,现在很苦恼,请帮忙!
出现的故障如下。
IMPORTANT: Do not modify the generated servlets
Unhandled error! You might want to consider having an error page to report such
errors more gracefully
com.sun.jsp.JspException: Compilation failed:Note: sun.tools.javac.Main has been
deprecated.
work\%3A80%2F\check2_jsp_1.java:76: Incompatible type for return. Can't convert
boolean to java.lang.Boolean.
return true;
^
work\%3A80%2F\check2_jsp_1.java:77: Incompatible type for return. Can't convert
boolean to java.lang.Boolean.
else return false;
^
work\%3A80%2F\check2_jsp_1.java:92: Incompatible type for if. Can't convert java
.lang.Boolean to boolean.
if(mycheck.isEmpty(name))
^
3 errors, 1 warning
...全文
15 点赞 收藏 3
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
qinjianhui 2003-03-26
谢谢!!!
回复
xby45 2003-03-25
Boolean->boolean
回复
xby45 2003-03-25
public Boolean isEmpty(String str)改为public boolean isEmpty(String str)试一试
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2003-03-25 10:48
社区公告
暂无公告