操作:struts2中直接訪問jsp
異常:The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag.
環境:struts2
原因:如果想要在jsp文件中,采用 struts的tag,那么jsp必須是通過action跳轉得到,也就是必須通過web.xml所配置的過濾器訪問文件,否則會有異常。
解決辦法:
配置通用操作:
<action name="*">
<result>/{1}.jsp</result>
</action>
以前訪問jsp的操作換成action的操作:eg: 原來 test.jsp 先在test.do