2010-06-04 19 views
3

我努力學習Apache Struts框架,我已經寫了一個小應用程序,確實類招生,但每當我試圖加載了我的應用程序,它只是吐出了以下異常:的Apache Struts的:無法檢索的ActionForward

javax.servlet.ServletException: 
    org.apache.jasper.JasperException: 
    javax.servlet.ServletException: 
     javax.servlet.jsp.JspException: Cannot create rewrite URL: 
      java.net.MalformedURLException: Cannot retrieve ActionForward named adminLogin 

index.jsp頁的樣子:

<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> 
<logic:redirect forward="showLogin"/> 

struts-config.xml相關部分:

<global-forwards> 
    <forward name="showLogin" path="/showLogin.do" /> 
</global-forwards> 
<action-mappings> 
    <action path="/showLogin" forward="/pages/choose.jsp" /> 
    <action path="/adminLogin" forward="/pages/adminLogin.jsp" /> 
</action-mappings> 

最後的choose.jsp文件:

<%@ page import="javax.sql.*"%> 
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> 
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%> 

<h1>Who are you?</h1> 
<ul> 
    <li><html:link forward="adminLogin">Administrator</html:link></li> 
    <li><html:link forward="instructorLogin">Instructor</html:link></li> 
    <li><html:link forward="studentLogin">Student</html:link></li> 
</ul> 
+2

如果你正在學習Struts for Work,那麼,好吧。如果你是爲了「有趣」而學習它,那麼停下來,轉身,然後跑到別的地方去。 Struts 2或Stripes至少。 Struts 1在1999年是新穎的,但今天幾乎沒有價值。帶有JSTL和EL的JSP 2.0以及像Stripes或Struts 2這樣的現代框架更值得你花時間。最好學習原始的Servlets而不是Struts 1. – 2010-06-04 00:47:07

+1

這對於學校來說實際上是這樣,我在這個問題上沒有選擇。如果我有選擇,我已經放棄了。這是非常令人沮喪和抽象 – nicotine 2010-06-04 00:53:11

回答

2

我不這樣做的Struts,所以不要束縛我就可以了,但這個錯誤似乎表明,它在配置某處期待<forward name="adminLogin" />。你可能想要爲其他兩名前鋒一樣。