关于struts2.1.8根目录资源访问的问题!

我的strtus2.1.8的web project中,发现WebRoot目录及其子目录下的文件都不能通过页面访问。比如:<img id="serach2" src="${pageContext.request.contextPath}static/images/serach.jpg" />,图片出不来,还有其他格式的文件,如css,js等文件都访问不到!但是页面见的跳转都很正常。请教一下是不是我的strtus.xml文件配置的有问题。struts.xml文件如下:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
 "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
 "http://struts.apache.org/dtds/struts-2.1.dtd">
 
<struts>

 <constant name="struts.objectFactory" value="spring" />
 <constant name="struts.i18n.encoding" value="UTF-8" />
    
 <package name="default" extends="struts-default" namespace="/">
  <global-results>
   <result name="index">/index.jsp</result>
   <result name="success">/success.html</result>
   <result name="error">/error.jsp</result>
  </global-results>
 </package>
 <package name="person" namespace="/person" extends="struts-default">
  <action name="person_*" method="{1}" class="personAction">
   <result name="list" type="freemarker">/pages/person/list.ftl</result>
   <result name="add" type="freemarker">/pages/person/add.ftl</result>
   <result name="edit" type="freemarker">/pages/person/update.ftl</result>
   <result name="save" type="redirect">person_list.action</result>
  </action>
 </package>

 
</struts>

[color=blue][b]把static换成其他名字吧,Struts似乎对Static有特别的处理。[/b][/color]

[b]应该是这样,少了个/[/b]
[code="java"]${pageContext.request.contextPath}/static/images/serach.jpg[/code]

看你的生成的HTML的源码中,img标签的值是什么?

http://127.0.0.1:8088/testJpa/static/images/serach.jpg

直接放入浏览器地址栏试试能不能访问?

还有你工程目录什么样的?

http://127.0.0.1:8088/testJpa/static/images/serach.jpg

为什么你图片上的端口是8080,而HTML的是8088?