为什么用jcreator编译servlet却总显示不对?(代码如下) ( 积分: 100 )

  • 主题发起人 主题发起人 vkeyj
  • 开始时间 开始时间
V

vkeyj

Unregistered / Unconfirmed
GUEST, unregistred user!
这是要编译的代码
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class j5_03 extends HttpServlet
{
public voiddo
Post(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
{
res.setContentType("text/html");
PrintWriter out=res.getWriter();
out.println(&quot;<html><head></head><body>&quot;);
out.println(&quot;name:&quot;+req.getParameter(&quot;myname&quot;));
out.println(&quot;<br>&quot;);
out.println(&quot;love:&quot;+req.getParameter(&quot;love&quot;));
out.println(&quot;</body></html>&quot;);
out.close();
}
public voiddo
Get(HttpServletRequest REQ,HttpServletResponse res)throws ServletException,IOException
{
doPost(req,res);
}
}

jcreator提示的错误信息是:
description resource location
cannot resolve symbol variable req j5_03.java line 19
我已经在jcreator中增加了servlet-api.jar包,修改了很多次,还是找不到原因,请高手指点迷津
 
这是要编译的代码
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class j5_03 extends HttpServlet
{
public voiddo
Post(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
{
res.setContentType(&quot;text/html&quot;);
PrintWriter out=res.getWriter();
out.println(&quot;<html><head></head><body>&quot;);
out.println(&quot;name:&quot;+req.getParameter(&quot;myname&quot;));
out.println(&quot;<br>&quot;);
out.println(&quot;love:&quot;+req.getParameter(&quot;love&quot;));
out.println(&quot;</body></html>&quot;);
out.close();
}
public voiddo
Get(HttpServletRequest REQ,HttpServletResponse res)throws ServletException,IOException
{
doPost(req,res);
}
}

jcreator提示的错误信息是:
description resource location
cannot resolve symbol variable req j5_03.java line 19
我已经在jcreator中增加了servlet-api.jar包,修改了很多次,还是找不到原因,请高手指点迷津
 
要设置web.xml
 
doGet(HttpServletRequest REQ,HttpServletResponse res)
req区分大小写的
 
doGet(HttpServletRequest REQ,HttpServletResponse res)的REQ改成req,或者doPost(req,res);的req改成REQ
 
谢谢大家,非常感谢!
 
后退
顶部