在servlet的doPost里有
String taskdate = request.getParameter("date");
String round = request.getParameter("round");在另一个class里要得到taskdate和round的值,应该如何写呢?我试过用继承,好象不行
String taskdate = request.getParameter("date");
String round = request.getParameter("round");在另一个class里要得到taskdate和round的值,应该如何写呢?我试过用继承,好象不行
设置进sessionsession.getAttribute("taskdate" );获取出来
ServletContext application = getServletContext();
application.setAttribute("name",name);在另个类里写了String na = application.getAttribute(name);报错
TaskEntry.java:29: cannot find symbol
symbol : variable application
在另外一个类里能用application.getAttribute(name);吗?
但还是报同样的错误
ServletContext application = getServletContext();
application.setAttribute("name",name);servletB
String name = application.getAttribute("name");还是取不到值,还需要加些什么吗?
ServletContext application = getServletContext();
的方法实现
编译都能通过,但到jsp里请求提交时就在上面这句报错了
description: The server encountered an internal error () that prevented it from fulfilling this request.
servletA里
ServletContext application = getServletContext();
application.setAttribute("name",name);
servletB里
String name = (String)application.getAttribute("name");我想请教下ServletContext在doPost里使用有什么要求吗?我在单个servlet里使用也有问题比如我想在servlet加个访问计数器
ServletContext context = getServletContext();
Integer id=(Integer)context.getAttribute("id");
if(id==null)
{
d = new Integer(1);
}
else
{
id = new Integer(id.intValue()+1);
}
context.setAttribute("id",id);编译能通过,但到jsp里请求提交时就报错了
description: The server encountered an internal error () that prevented it from fulfilling this request.
在没有加ServletContext时运行正常,加了之后提交请求就报错了
ServletContext application = getServletContext();
搞什么session传参数,要传也用request传,笨