【发布时间】:2013-08-31 07:15:59
【问题描述】:
我写了一个过滤器来决定用户登陆页面在它到达我的欢迎文件之前。欢迎文件的编写方式是从过滤器获取输入并将用户导航到特定页面。
我的欢迎文件标签是...
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
而我的过滤器配置是
<filter>
<filter-name>LandingPageFilter</filter-name>
<filter-class>com.mypack.test.filters.LandingPageFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>LandingPageFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
当每个请求都通过此过滤器时,上述格式运行良好,我想避免这种情况。当我点击http://localhost:8000/landing 时,它应该只第一次到达过滤器,然后即使我访问http://localhost:8000/landing/edit,它实际上应该绕过过滤器执行相关的servlet。
我也试过这个<url-pattern>/*/index.jsp</url-pattern>,但没用。为什么我使用它,因为 上下文 可能会有所不同,但应用程序会相同。
【问题讨论】: