Hi,

I have gotten my first extremely simple (2 web pages) Struts application working and am slowly adding features to it. In first page, you enter data into a form and click the submit button. This takes you to the second page, which displays the data from the form; and clicking the submit button on this page takes you back to the first page--very simple.

My problem is that for the first page (entryPage.jsp), its form bean, EntryForm.java seems to be executing, but the corresponding action class, EntryAction.java does not. I have checked two very good books and have checked my code against sample code, but i can't figure out what's different.

Below, I've listed the struts-config.xml and EntryAction.java files. I know I must be overlooking something incredibly simple. Thanks for your help.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd";>
<struts-config>
<data-sources/>
<form-beans>
<form-bean name="entryForm" type="sample.EntryForm"/>
<form-bean name="displayForm" type="sample.DisplayForm"/>
</form-beans>
<global-exceptions/>
<global-forwards>
<forward name="begin" path="/Display.do"/>
</global-forwards>
<action-mappings>
<action name="entryForm" path="/Entry" scope="request" type="sample.EntryAction">
<forward name="displayPage" path="/pages/displayPage.jsp"/>
</action>
<action name="displayForm" path="/Display" scope="request" type="sample.DisplayAction">
<forward name="entryPage" path="/pages/entryPage.jsp"/>
</action>
</action-mappings>
<controller/>
</struts-config>


package sample;

import java.io.*;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.action.DynaActionForm;
import org.apache.struts.util.MessageResources;

public class EntryAction extends org.apache.struts.action.Action {

    // Global Forwards
    public static final String GLOBAL_FORWARD_begin = "begin";

    // Local Forwards
    private static final String FORWARD_displayPage = "displayPage";

    public EntryAction() {
        System.out.println ("EntryAction: Reached constructor method");
    }

public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
// TODO: Write method body
return mapping.findForward(FORWARD_displayPage);
}
}


***** end *****



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to