开发者

enable url rewriting for a 12 year old java web application

I'm trying to ad开发者_开发技巧d the session tracking feature to a 12 year old java web application. Which uses MVC pattern with jsp and servlets. We need to make it work if cookies are disabled.

I like to know what is the best way to implement session tracking to this application? :)

and when i use getRequestDispatcher, do i need to use encodeURL ? like this ?

getRequestDispatcher(res.encodeURL(jspname)); 

Thanks...


You need to go through the application looking for places where it generates internal links, and pass those links through the HttpServletResponse.encodeUrl() method. This will rewrite the URL if the application thinks it's necessary, such as when it's detected that cookies are not being supported by the client.

Given the age of the application, you may have to do this the hard way, i.e. using JSP expressions like:

<a href="<% response.encodeUrl("/link") %>">

If JSTL is an option, then the <c:url> makes url rewriting a little bit easier.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜