主题:linux下的找不到servlet软件包的问题
我的servlet的.java文件ServletToJsp.java源码如下:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ServletToJsp extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
{
try{
req.setAttribute("ServletName","ServletToJsp");
getServletConfig().getServletContext().getRequestDipatcher("/ServletUseJsp.jsp").forward(req.res);
}
catch(Exception e){
e.printStackTrace();}
用javac编译时出现如下错误:
ServletToJsp.java:2: 软件包 javax.servlet 不存在
import javax.servlet.*;
^
ServletToJsp.java:3: 软件包 javax.servlet.http 不存在
import javax.servlet.http.*;
^
ServletToJsp.java:4: 找不到符号
符号: 类 HttpServlet
public class ServletToJsp extends HttpServlet
^
ServletToJsp.java:6: 找不到符号
符号: 类 HttpServletRequest
位置: 类 ServletToJsp
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
^
ServletToJsp.java:6: 找不到符号
符号: 类 HttpServletResponse
位置: 类 ServletToJsp
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
^
ServletToJsp.java:6: 找不到符号
符号: 类 ServletException
位置: 类 ServletToJsp
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
^
ServletToJsp.java:10: 找不到符号
符号: 方法 getServletConfig()
位置: 类 ServletToJsp
getServletConfig().getServletContext().getRequestDipatcher("/ServletUseJsp.jsp").forward(req.res);
请大家帮忙解决.
^
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ServletToJsp extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
{
try{
req.setAttribute("ServletName","ServletToJsp");
getServletConfig().getServletContext().getRequestDipatcher("/ServletUseJsp.jsp").forward(req.res);
}
catch(Exception e){
e.printStackTrace();}
用javac编译时出现如下错误:
ServletToJsp.java:2: 软件包 javax.servlet 不存在
import javax.servlet.*;
^
ServletToJsp.java:3: 软件包 javax.servlet.http 不存在
import javax.servlet.http.*;
^
ServletToJsp.java:4: 找不到符号
符号: 类 HttpServlet
public class ServletToJsp extends HttpServlet
^
ServletToJsp.java:6: 找不到符号
符号: 类 HttpServletRequest
位置: 类 ServletToJsp
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
^
ServletToJsp.java:6: 找不到符号
符号: 类 HttpServletResponse
位置: 类 ServletToJsp
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
^
ServletToJsp.java:6: 找不到符号
符号: 类 ServletException
位置: 类 ServletToJsp
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
^
ServletToJsp.java:10: 找不到符号
符号: 方法 getServletConfig()
位置: 类 ServletToJsp
getServletConfig().getServletContext().getRequestDipatcher("/ServletUseJsp.jsp").forward(req.res);
请大家帮忙解决.
^