servlet用forward转不到JSP,帮我看看哪里错了
import java.io.IOException;
import javax.servlet.ServletException;
//ServletToJSP.java
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ServletToJSP extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
resp.setContentType("text/html");
req.setAttribute("servletName", "ServletToJSP");
this.getServletContext().getRequestDispatcher("/servlet_jsp/ServeltUseJsp.jsp").forward(req,resp);
//this.getServletConfig().getServletContext().getRequestDispatcher("/servlet_jsp/ServeltUseJsp.jsp").forward(req, resp);
//resp.sendRedirect(req.getContextPath()+"/servlet_jsp/ServletUseJsp.jsp");
}
}
出现这种错误
HTTP Status 404 - /my/servlet_jsp/ServeltUseJsp.jsp
--------------------------------------------------------------------------------
type Status report
message /my/servlet_jsp/ServeltUseJsp.jsp
description The requested resource (/my/servlet_jsp/ServeltUseJsp.jsp) is not available.
--------------------------------------------------------------------------------
相关问答:
一个网站,之前是用ASP写的,现在用JSP添加了一些新的页面上去,请问一个网站能不能同时支持ASP和JSP?如果可以的话,需要如何设置呢?谢谢,不好意思,就剩这么一点点可用分了。。
就是环境问题
up
可以装 ......
包括参数
String path = request.getContextPath();
String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/"; ......
如题,我是用struts2做的网页,用了radio标签,每个选项前都有一个小圆圈,我需要把小圆圈去掉,单击字就好,被选中的选项背景变色。
就像大多数网站的分类检索,比如这个网站的那样的根据各种条件的实时搜索:
ht ......
//用客户的session的id建立一个临时文件:
//String tempFileName=(String)session.getId();
String tempFileName = (String)session.getId();
//out.println(& ......