开发者

using servlets in a struts 2 project [duplicate]

开发者 https://www.devze.com 2023-01-19 11:15 出处:网络
This question already has an answer here: Filter mapping for everything to Struts2 besides one servlet?
This question already has an answer here: Filter mapping for everything to Struts2 besides one servlet? (1 answer) Closed 2 years ago.

I am building an application using struts2. The web.xml file looks like below

<filter> 
    <filter-name>struts2</filter-name> 
    <filter-class> 
        org.apache.struts2.dispatcher.ng.filt开发者_开发知识库er.StrutsPrepareAndExecuteFilter 
    </filter-class> 
</filter> 

<filter-mapping> 
    <filter-name>struts2</filter-name> 
    <url-pattern>/*</url-pattern> 
</filter-mapping> 

The application runs fine. Now I have a JSP which needs some input from servlet, So i wrote a servlet and added servlet-mapping in web.xml, but the server cannot find the servlet because of the filter-mapping. How to use servlets in struts 2 and what should web.xml look like?

from: http://struts-2.464677.n5.nabble.com/using-servlets-in-a-struts-2-project-td465399.html


That particular servlet should be excluded from you Struts filter in struts.xml

0

精彩评论

暂无评论...
验证码 换一张
取 消