简体   繁体   中英

JSP redirect/forward

I have this page:

http://example.com/folder/page.jsp

I would like to redirect/forward, in case of error/exception to the page http://example.com/page.jsp (as you can see the path is different).

doing <jsp:forward page="/page.jsp"> does work but all css and img ref now searches for http://example.com/folder/css , http://example.com/folder/img , without keeping the example.com/page.jsp layout.

How can I fix this?

Reference you css, javascript and images in a absolute way like this:

<link rel="stylesheet" type="text/css" href="/css/my.css" />

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM