Asad,

First, you might have better luck on the Struts Users mailing list at
[email protected], rather than the Tomcat Users mailing list. Struts is
just one of the many web application frameworks that works with Tomcat.
Struts also works with many other application servers.

Second, looking at your StrutsConfig.xml, it seems some attributes are
missing on the "<action" tag. I believe that you at least need the "name"
attribute supplied to tell Struts about the form bean that you will be using
as input. If you will use validation, then you must also use the "input"
attribute, so Struts can post errors back to the correct page. And of course
you must also provide a "form-bean" tag to identify the form. It might look
something like:

  <?xml version="1.0" encoding="ISO-8859-1" ?>
  <!DOCTYPE struts-config PUBLIC
      "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
      "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd";>
  <struts-config>
    <form-beans>
      <form-bean
        name="registrationForm"
        type="registration.RegistrationForm"
      />
    </form-beans>

    <action-mappings>
       <action path="/businessToolsStepOne"
type="registration.BusinessToolsStepOneAction"
               name="registrationForm" input="/registrationForm.jsp"
validate="false">
          <forward name="missing-business-data"
path="/missingBusinessData.jsp" />
          <forward name="business-tools-step-two"
path="/businessToolsStepTwo.jsp" />
       </action>
    </action-mappings>
  </struts-config>

But, you will get much better help on the Struts Users mailing list and in
the provided documentation and examples at http://struts.apache.org.

HTH - Richard

-----Original Message-----
From: Asad Habib [mailto:[EMAIL PROTECTED] 
Sent: Sunday, October 23, 2005 12:43 PM
To: [email protected]
Subject: Struts Application Logic Error

Hello. I am currently developing a Struts application. For some reason, form
variables are not being transmitted upon form submission and at the same
time there is no error or stack trace that I can reference to diagnose the
error. I am not able to access the form variables inside my action class for
which I have provided the code below (i.e. the form variables always have a
value of null). I have also provided the contents of struts-config.xml
below. FYI, I am not using the Struts validator. Any help would be greatly
appreciated. Thanks.

- Asad



package registration;

import javax.servlet.http.*;
import org.apache.struts.action.*;

public class BusinessToolsStepOneAction extends Action {
    public ActionForward execute (ActionMapping mapping,
                                 ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response)
          throws Exception {
       String businessName = request.getParameter("businessName");
       String businessAddress = request.getParameter("businessAddress");
       String businessZipCode = request.getParameter("businessZipCode");
       String businessPhoneNumber =
request.getParameter("businessPhoneNumber");

       if ((businessName == null) || (businessAddress == null) || 
(businessZipCode == null) || (businessPhoneNumber == null)) {
          return (mapping.findForward("missing-business-data"));
       }
       else {
          return (mapping.findForward("business-tools-step-two"));
       }
    }
}




<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
    "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd";>

<struts-config>
    <global-forwards>
       <forward name="home" path="/home.jsp" />
    </global-forwards>

    <action-mappings>
       <action path="/businessToolsStepOne"
type="registration.BusinessToolsStepOneAction">
          <forward name="missing-business-data"
path="/missingBusinessData.jsp" />
          <forward name="business-tools-step-two"
path="/businessToolsStepTwo.jsp" />
       </action>
    </action-mappings>
</struts-config>

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



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

Reply via email to