struts2 拦截器后跳转页面问题

来源:百度知道 编辑:UC知道 时间:2024/06/25 20:50:26
我用了自编的拦截器,如果输入错误的action就返回Action.LOGIN,在struts.xml中,设置<result name="login">/index.jsp</result>,但是跳转到index.jsp的页面时,页面上的图片和flash不能显示,向高手求助!!!!!!
我把<result name="login">/index.jsp</result>改成<result name="login" type="redirect">/index.jsp</result>,结果就没事了

因为跳转是服务器端跳转,地址栏没改变,所以会造成路径错误,建议你这里将图片等的路径改为以下形式:

<img src="${pageContext.request.contextPath}/image/xxxx.gif">

其中/image/xxx.gif 为你的图片在WebRoot下的路径和文件名。

二楼正解!引用路径的时候要考虑这些问题!

路径问题..............