struts2中的路径问题是根据action的路径而不是jsp路径来确定,所以尽量不要使用相对路径。虽然可以用redirect方式解决,但redirect方式并非必要。
解决办法:统一使用绝对路径或者在head中指定<base href="<%=basePath%>" />
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/";
注:如果在浏览器中输入http://127.0.0.1:9900/projectName/,这个时候优先返回WebContent目录下的index.jsp页面给客户端,如果没有这个index.jsp,它才会在struts.xml中找有没有对应的namespace[/]和action name[]的配置,如果没有,页面报错。【这个是本人测试后得出的结果】