I want to develop a website such as
http://xxxxx.com/username (like facebook URL style) on Java Servlet environment(GAE/J), and do not want to use JSP stuff, since I develop a rich html5 site with JQuery.
I've already done the client structure with HTML5 framework and do not want to start with JSP stuff from a scratch.
I could control the URI request via web.xml
<servlet>
<servlet-name>SubDirRouter</servlet-name>
<servlet-class>com.myproject.SubDirRouter</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SubDirRouter</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
Is it possible to 'foward' not 'redirect'(since http://xxxxx.com/username URL disappears) to a member.html (HTML5 application) file from the SubDirRouter servlet?
OR
simply map url-pattern-> /* to a member.html file ??
and if it's possible please show me how. A sample code or a site containing that would be appreciated.
Thank you. Again, a last option to me is to use JSP and discard html.
是的,您可以通过getRequestDispatcher(path).forward(..)
内部“转发”:
request.getRequestDispatcher("/yourHtm5page.html").forward(request, response);
Well,
usually an temp-redirect (307) should NOT change the original request-url (/username in your case).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.