阿,一个小小的例子,如何就运行不了呢?
求助阿,一个小小的例子,怎么就运行不了呢???说明:A.html中点击个按钮,到B.jsp,显示个文本。目录结构:OpenPa
求助阿,一个小小的例子,怎么就运行不了呢???
说明:A.html中点击个按钮,到B.jsp,显示个文本。
目录结构:

OpenPage.java
结果:
[解决办法]window.open("/openpage", '_blank');[解决办法]protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { return doPost(request, response); }
[解决办法]
要去到servletContext 的级别~ 获取它的请求分发器。才能forward过去~ 你试下~ 有问题再问我~
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=gbk");
request.setAttribute("servletName", "ServletToJSP");
getServletConfig().getServletContext().getRequestDispatcher("/ServletUseJsp.jsp").forward(request, response);
}[解决办法]第二三行忘了删走~ 是我测试时候用的~怀疑是servlet跳转到jsp 的错误~ 其他代码还没看~
[解决办法]你的路劲有问题应该为window.open("http://localhost:8080/testweb1/openpage", '_blank');
[解决办法]项目名称得加上呀
[解决办法]你web.xml中配置servlet了么?
[解决办法]http://localhost:8080/testWeb1才是你的网站地址。
你访问http://localhost:8080/testWeb1/A.html
http://localhost:8080/testWeb1/B.jsp才对的。