If you are mapping to Impala modules using the /* mapping in web.xml,
then the value for request.getPathInfo() will not be set by the web
container.
In this case, you will need to add the following to the web:to-module entry:
<web:to-module prefix = "/struts2" setServletPath="true"/>
In general, I would recommend you to use this configuration.
However, in doing so in the current example, this will probably affect
mappings within the application in your example, because the
request.getServletPath() in your example will be set to the prefix value
(ie /struts2). To stop this from happening, use
<web:to-module prefix = "/struts2" setServletPath="true" servletPath=""/>
I've tried this approach out in the URL mapping sample
(http://code.google.com/p/impala/wiki/SamplesURLMapping), to confirm
that it works.
Phil
But if I use struts2,I can not set setServletPath="true".
... you will need to add the following to the web:to-module entry:
<web:to-module prefix = "/struts2" setServletPath="true"/>
In general, I would recommend you to use this configuration.
However, in doing so in the current example, this will probably affect
mappings within the application in your example, because the
request.getServletPath() in your example will be set to the prefix value
(ie /struts2). To stop this from happening, use
<web:to-module prefix = "/struts2" setServletPath="true" servletPath=""/>
I've tried this approach out in the URL mapping sample
(http://code.google.com/p/impala/wiki/SamplesURLMapping), to confirm
that it works.
In other words, you can either setServletPath="true", but will probably cause you to have to change internal mappings, or you can use the setServletPath="true" servletPath="" combination. Phil
If setServletPath="", then it should work with the image placed in the
package folder struts2/img (corresponding with the package struts2.img
on the classpath)
corresponding to the URL
http://localhost:8080/mydemo-host/struts2/img/logo.gif
with setServletPath = "/struts2"
the same URL would work with the image in the package folder img
The struts2 package should have nothing to do with it.
Phil
Yes, I've taken a closer look and there does appear to be a problem -
apparently the JSP support does not like it when you set the
setServletPath="true" flag.
I'll look into this, and try suggest a workaround in the meantime shortly.
Cheers,
Phil
I presume you are using the snapshot update ...
Phil
> <result>/*jsp*/MyBatch.jsp</result>
> </action>
> ......
> </package>
>
>
See the answers below.
Phil
jokoul webster wrote:
> Phil:
> 1:Now,within a Sturts2 individual web module we can display images only
> keep the jsp folder name as same as module prefix,but unfortunately,in this
> case ,images can not be displayed within a individual Spring MVC web module.
>
Check out the URL mapping sample, which uses the resource servlet to
serve CSS (although not for images, although adding this should be
trivial) within a Spring MVC-based application.
See http://code.google.com/p/impala/wiki/SamplesURLMapping
> 2:Which servlet sould be fit for css
> files,"org.springframework.js.resource.ResourceServlet" or "
> org.impalaframework.web.servlet.ResourceServlet"?
>
You can use either. Actually, the Impala version is taken directly from
the Spring version (saves you having to add the extra Spring JS
dependency, which contains quite a lot of JavaScript specific stuff
which is not very interesting for me)
>
> JK.Webster
>
>