關於The requested resource is not available這個問題
我是使用struts,對着書上的例子做的。在測試項目時,首頁可以出來,就是跳不到登錄成功后需要出現的歡迎頁。 在網上查了許多方法,都沒有解決。自己的xml文件也沒有出錯,於是懷疑是不是自己form提交的路徑出了問題。
原來書上的提交路徑是 <form action="/Login/Login.do" method="post">
經過我無數次的修改,比如變成Login/Login.do
,再比如更換xml文件和form路徑的大小寫,還是不行最后我嘗試了Login.do
,登錄成功后的歡迎頁就出來了。 以下是我的struts-config.xml
<struts-config> <data-sources /> <form-beans > <!-- 注冊LoginForm.java --> <form-bean name="loginForm" type="Login.LoginForm"></form-bean> </form-beans> <global-exceptions /> <global-forwards /> <action-mappings > <!-- 注冊Action --> <!-- path指提交路徑 type指Action的路徑 name的值需要與ActionForm的name屬性一致 --> <action path="/Login" name="loginForm" type="Login.LoginAction"></action> </action-mappings> <message-resources parameter="strutsTest.ApplicationResources" /> </struts-config>