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

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
...全文
56 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
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)试一试

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧