我正在嘗試學習Apache Struts框架,並且已經編寫了一個小型應用程序,用於註冊類,但每當我嘗試加載我的應用程序時,它只是吐出以下異常:java.net.MalformedURLException:無法檢索ActionForward
org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot create redirect URL: java.net.MalformedURLException: Cannot retrieve ActionForward named HelloWorld
我的index.jsp頁面看起來像:
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"% >
<logic:redirect forward="helloWorld"/ >
我struts-config.xml中的相關部分:
<form-beans>
<form-bean name="HelloWorldForm" type="com.Form.HelloWorldAction" />
</form-beans>
<global-forwards>
</global-forwards>
<action-mappings>
<action name="HelloWorldForm" path="/helloWorld" type="com.Form.HelloWorldAction">
<forward name="success" path="/Success.jsp" />
</action>
</action-mappings>
HelloWorldAction頁的樣子:
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
HelloWorldForm Hw = (HelloWorldForm) form;
Hw.setMessage("Hello World");
return mapping.findForward("success");
成功頁的樣子:
<bean:write name="HelloWorldForm" property="message"/ >
嗨Dooo NoooN,我做了你做的更正,但我仍然得到相同的錯誤。 – Rupali