【发布时间】:2012-07-11 12:33:57
【问题描述】:
请求派发时是否可以更改url。
这是我的代码
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException
{
List<HomePageServicesDescription> data= HomePageServicesDescriptionDB.showHomePageServicesDescription();
req.setAttribute("description", data);
req.getRequestDispatcher("index.jsp").forward(req,res);
}
所以当在网络浏览器中看到它时,它会给出 url=http://localhost:8888/url-mapping 的 servlet。
但我想要那个 url=http://localhost:8888/index.jsp。怎么可能。
【问题讨论】:
标签: jsp servlets requestdispatcher