| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 568 人关注过本帖
标题:求大家帮帮忙,我是个初学JSP的新手
只看楼主 加入收藏
linshanjiang
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-4-7
收藏
 问题点数:0 回复次数:5 
求大家帮帮忙,我是个初学JSP的新手

各位朋友,我是个初学jsp的新手,请各位帮帮忙,我用JCreator执行这个servlet总会有很多的错误,执行别的servlet也会有类似的错误,谁能给我解释一下阿!代码如下:
package test;
  import java.io.IOException;
  import java.io.PrintWriter;
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  public class Test extends HttpServlet {
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
  throws ServletException, IOException {
  PrintWriter out=response.getWriter();
  out.println("<html><body><h1>This is a servlet test.</h1></body></html>");
  out.flush();
  }
  }
错误如下:
C:\test\Test.java:2: illegal character: \12288
  import java.io.IOException;
^
C:\test\Test.java:2: illegal character: \12288
  import java.io.IOException;
^
C:\test\Test.java:3: illegal character: \12288
  import java.io.PrintWriter;
^
C:\test\Test.java:3: illegal character: \12288
  import java.io.PrintWriter;
^
C:\test\Test.java:4: illegal character: \12288
  import javax.servlet.ServletException;
^
C:\test\Test.java:4: illegal character: \12288
  import javax.servlet.ServletException;
^
C:\test\Test.java:5: illegal character: \12288
  import javax.servlet.http.HttpServlet;
^
C:\test\Test.java:5: illegal character: \12288
  import javax.servlet.http.HttpServlet;
^
C:\test\Test.java:6: illegal character: \12288
  import javax.servlet.http.HttpServletRequest;
^
C:\test\Test.java:6: illegal character: \12288
  import javax.servlet.http.HttpServletRequest;
^
C:\test\Test.java:7: illegal character: \12288
  import javax.servlet.http.HttpServletResponse;

^
C:\test\Test.java:7: illegal character: \12288
  import javax.servlet.http.HttpServletResponse;
^
C:\test\Test.java:8: illegal character: \12288
  public class Test extends HttpServlet
^
C:\test\Test.java:8: illegal character: \12288
  public class Test extends HttpServlet
^
C:\test\Test.java:10: illegal character: \12288
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
^
C:\test\Test.java:10: illegal character: \12288
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
^
C:\test\Test.java:11: illegal character: \12288
  throws ServletException, IOException
^
C:\test\Test.java:11: illegal character: \12288
  throws ServletException, IOException
^
C:\test\Test.java:13: illegal character: \12288
  PrintWriter out=response.getWriter();
^
C:\test\Test.java:13: illegal character: \12288
  PrintWriter out=response.getWriter();
^
C:\test\Test.java:14: illegal character: \12288
  out.println("<html><body><h1>This is a servlet test.</h1></body></html>");
^
C:\test\Test.java:14: illegal character: \12288
  out.println("<html><body><h1>This is a servlet test.</h1></body></html>");
^
C:\test\Test.java:15: illegal character: \12288
  out.flush();
^
C:\test\Test.java:15: illegal character: \12288
  out.flush();
^
C:\test\Test.java:16: illegal character: \12288
  }
^
C:\test\Test.java:16: illegal character: \12288
  }
^
C:\test\Test.java:17: illegal character: \12288
 }
^
C:\test\Test.java:17: <identifier> expected
 }
^
28 errors

搜索更多相关主题的帖子: JSP 初学 
2007-04-08 15:13
iyuohz
Rank: 1
等 级:新手上路
帖 子:107
专家分:0
注 册:2006-2-22
收藏
得分:0 
建议你换个IDE,jc一开始还可以,现在写 servlet了,用用jbuilder 或是 eclipse ...啥的就行了

代码应该没错

2007-04-08 16:06
风月_无边
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:60
帖 子:2960
专家分:652
注 册:2007-1-19
收藏
得分:0 
非法字符!!

我的网站 http://www.
2007-04-08 20:06
喃瑟
Rank: 1
等 级:新手上路
威 望:1
帖 子:472
专家分:0
注 册:2007-1-25
收藏
得分:0 
jCreater ,即使你设置了环境变量,好像也里面识别不了servlet API包

光与影的1/2
2007-04-09 08:59
liuyi900
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2007-4-9
收藏
得分:0 
有可能是你的JDK的问题  我用的也是JCREATER 编写SERVLET一点问题也没有  
2007-04-09 09:06
linshanjiang
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-4-7
收藏
得分:0 
谢谢各位~~~~
2007-04-09 22:34
快速回复:求大家帮帮忙,我是个初学JSP的新手
数据加载中...
 
   



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

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