JSP how to manage welcome-file-list?
How can i redirect users to one of the pages accordingly his domain name?
web.xml<welcome-file-list>
<welcome-file>index.jsp</welcome-fi开发者_如何转开发le>
<welcome-file>now_see_this.jsp</welcome-file>
<welcome-file>Another.jsp</welcome-file>
</welcome-file-list>
Thanks!!!
You can
- make a filter (
javax.servlet.Filter
) - map it to
/
- check
request.getServerName()
and compare with a predefined list of domains request.getRequestDispatcher("/someIndex.jsp").forward()
depending on the domain.
However, it looks like a strange use-case, because the user will still be able to access the index files for other domains if he knows them (if they are not hidden in WEB-INF
). But without knowing your requirements I can't suggest a better solution.
精彩评论