tags:

views:

38

answers:

1

I am trying to learn the Apache Struts framework and I have written a small application that does class enrollments but whenever I try and load up my application it just spits out the following exception:

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

My index.jsp page looks like:

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

The relevant parts of my 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>

And finally the choose.jsp file:

<%@ 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>
+1  A: 

I don't do Struts, so don't pin me on it, but the error seems to indicate that it is expecting a <forward name="adminLogin" /> somewhere in the config. You might want to have the same for the other two forwards.

BalusC