一般的路径是/web应用名称/jsp路径/jsp名称
解决方案 »
- 我这个简单的socket为什么客户端没有关闭!被阻塞了
- 获取指定某一天的前一个月或前一年日期的方法
- 'readOnly' hibernate
- 一个让人很是郁闷的错误
- SSH 访问ACTION没反应 页面空白 控制台无错
- 求助!我的Tomcat 为什么用不了?
- XP下如何整合Tomcat5.5+SQLserver2000
- 紧急求助:textarea最大能输入多少个字符啊!怎么扩大输入的数量呢?
- 电子商务-会员积分实现代码
- 怎么用能让asp实现统计在线人数的功能。在线等待!!!帮忙送分!
- linux中jbuilder7+weblogic7运行jsp的错误, 请帮忙看看
- 求教关于决策支持系统中模型库的建立!!!(在线等待答复)
在testServ工程下,showRst.jsp在mvcTest\myWeb目录下,myservlet.java在src.cn.com.my目录下,以上的url写法有问题吗?
/myweb/showRst.jsp
/showRst.jsp三个都试试,总会有一个会对的。
搂主真的会给分吗?
/mvcTest/myWeb/showRst.jsp
/myweb/showRst.jsp
/showRst.jsp
不过向别的servlet转换是可以的。
以下是我的servlet源代码:
package com.test.servlet;import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;public class myServlet extends HttpServlet {
private static final String CONTENT_TYPE = "text/html; charset=GBK";
//Initialize global variables
public void init(ServletConfig config) throws ServletException
{
//servletContext = config.getServletContext();
super.init(config);
}
//Process the HTTP Get request //Process the HTTP Post request
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
//response.setContentType(CONTENT_TYPE);
//PrintWriter out = response.getWriter();
//String name=request.getParameter("name");
/*out.println("<html>");
out.println("<head><title>myServlet</title></head>");
out.println("<body bgcolor=\"#ffffff\">");
out.println("<p>The servlet has received a POST. This is the reply.</p>");
out.println("</body></html>");*/
String url="/myWeb/showRst.jsp";
//RequestDispatcher rd =request.getRequestDispatcher(url);
ServletContext sc = getServletContext();
RequestDispatcher rd =sc.getRequestDispatcher(url);
//response.sendRedirect("http://localhost:8080/myWeb/showRst.jsp");
rd.forward(request,response);
}
//Clean up resources
public void destroy() {
}
}