SSH 框架開啟專案自動執行action的第一種方法
web.xml不配置任何東西
<welcome-file-list>
<welcome-file></welcome-file>
</welcome-file-list></span>
如上,為什麼不把<welcome-file></welcome-file>也出掉,因為出掉之後會提示標籤不完整.
struts.xml如下
<action name="" class="index"> <result name="input">/login.jsp</result> <result name="error">/error.jsp</result> <result name="success">/index.jsp</result> </action>
name="",class="index"之所以寫這樣而不寫class="action.index.class",是SSH框架的功能,是action的例項在Spring容器中的物件名.</span>
重要的是<result name="success>/index.jsp</result>部分,index.jsp是web專案首頁.
名字叫index的action的返回字串需是success, 和紅色部分相匹配.像這樣開啟就會自動執行action
如果直接執行index.jsp的話action不會自動執行的!!
大家還有什麼方法嗎?分享分享唄!