求助,当要编译.java文件,需要导入jsp-api.jar时怎么做啊? 如题,顺便问一句在tomcat中一定要设classpath吗?除了这些还有什么要设的啊? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 第一个问题:引入jsp-api.jar,你把这个包加到环境变量中就可以了吧!一般我配tomcat的时候,就只把包加到环境变量中,和在tomcat-users.xml中加一个用户吧,其它的没什么配的了! 我的代码DispatcherServlet.javapackage mypack;import javax.servlet.*;import javax.servlet.http.*;import java.io.*;import java.util.*;public class DispatcherServlet extends HttpServlet{ private String target="/hello.jsp"; public void init(ServletConfig config) throws ServletException { super.init(config); }}public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException { doPost(request,response); }public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException { String username=request.getParameter("username"); String password=request.getParameter("password"); request.setAtrribute("USER",username); request.setAtrribut("PASWORD",password); ServletContext context=getServletContext(); System.out.println("Redirecting to "+ target); RequestDispatcher dispatcher= context.getRequestDispatcher(target); dispatcher.forward(request,response); } public void destroy() {} } 但编译,说缺少class和interface,怎么回事啊? 播放视频的代码,有点不懂,请高手解答!谢谢你们! java.lang.NoSuchMethodError 求教 fzlotuscn (无为一本)(真名林游)已经被封了ID但换了马甲NMDJSP() ,希望大家警惕这人,他还在到处乱发骗钱! 怎么能把excel保存成htm格式阿 jacob 读取dll出现下面错误 Trace有人用过吗? 请问哪位有jsp+SQL的投票系统? ^_^一个能让大家受益的问题…… 关于ssh的学习方法 hibernate连库出错的原因 JDBC连接SQL Server 2000问题
一般我配tomcat的时候,就只把包加到环境变量中,和在tomcat-users.xml中加一个用户吧,其它的没什么配的了!
package mypack;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;public class DispatcherServlet extends HttpServlet{ private String target="/hello.jsp";
public void init(ServletConfig config)
throws ServletException
{
super.init(config);
}
}
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,IOException
{
doPost(request,response);
}
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws ServletException,IOException
{
String username=request.getParameter("username");
String password=request.getParameter("password");
request.setAtrribute("USER",username);
request.setAtrribut("PASWORD",password);
ServletContext context=getServletContext();
System.out.println("Redirecting to "+ target);
RequestDispatcher dispatcher=
context.getRequestDispatcher(target);
dispatcher.forward(request,response); }
public void destroy()
{}
}