哪位帮我看看用JSP写的代码是哪出错了
<%@page contentType="text/html;charset=GB2312"%>
<HTML>
<%!Hashtable hashtable=new Hashtable();
public synchronized void putString(String s)
{
hashtable.put(s,s);
}
%>
<% String person_name=request.getParameter("name");
name_found=(String)hashtable.get(person_name);
if(name_found==null)
{
String person_email=request.getParameter("address");
if(person_email==null)
{
person_email="";
}
String Tokenizer fenxi=new String Tokenizer(person_email," @");
int n=fenxi.countTokens();
if(n>=3)
{
out.print("<BR>"+"你输入的email有不合法字符");
}
else
{
putString(person_name);
out.print("<BR>"+"您已注册成功");
out.put("<BR>"+"您注册的名字是"+person_name);
}
}
else
{
out.print("<BR>"+"该名字已存在,请您换个名字");
}
%>
</HTML>
追问:报的错,我已经贴出来了
问题是用jsp写的还用导入包吗?
当然要导入包啊,你难道用java写不用导入包的吗
异常An error occurred at line: 3 in the jsp file: /login2.jsp
Hashtable cannot be resolved to a type
就是报的3: <%!Hashtable hashtable=new Hashtable();这行的错
但是还是有错,你能帮我把这篇代码改改吗?
An error occurred at line: 11 in the jsp file: /login2.jsp
name_found cannot be resolved to a variable
8: }
9: %>
10: <% String person_name=request.getParameter("name");
11: name_found=(String)hashtable.get(person_name);
12: if(name_found==null)
13: {
14: String person_email=request.getParameter("address");
name_found=(String)hashtable.get(person_name); ,你name_found这个变量都没有声明啊。
你能接着帮办我看看其他的错误吗?我刚学有好多不明白的地方,非常感谢!
An error occurred at line: 20 in the jsp file: /login2.jsp
Syntax error, insert ";" to complete LocalVariableDeclarationStatement
20: String Tokenizer fenxi=new String Tokenizer(person_email," @");
20: String Tokenizer fenxi=new String Tokenizer(person_email," @");
这行【new String Tokenizer(person_email," @");】改成--new StringTokenizer(person_email," @");把空格去掉。。StringTokenizer就是一个类,多打个空格就语法错误了
我试了,还是有错
StringTokenizer fenxi=new StringTokenizer(person_email," @"); 前面那个也一样啊 ,把空格去掉。 - -!,劝你还是多看看java基础吧,这是基本的语法