Hello. Thanks for your help. Is form-beans essential even if I don't want to store form data in the session? Should the values of form variables not be available in the action class via the use of request.getParameter('x') even if form-beans aren't used? Offcourse, I will eventually want to use form-beans to capture form data but it seems that this data should be transmitted via HTTP regardless of whether one uses form-beans or not?

- Asad


On Mon, 24 Oct 2005, atta-ur rehman wrote:

Asad,

Is this your complete struts-config.xml? If so, you're missing <form-beans>
collection in it. Please add your form in the <form-beans> and then add the
"name" attribute in the action to refer to your form.

<form-beans>
<form-bean name="testForm" type="com.nms.webapp.test.TestForm"/>
</form-beans>

and then in your action mapping:


<action path="/businessToolsStepOne" type="
registration.BusinessToolsStepOneAction" name="testForm">

<forward name="missing-business-data" path="/missingBusinessData.jsp" />
<forward name="business-tools-step-two" path="/businessToolsStepTwo.jsp"
/>
</action>


also make sure sure in your JSP you're using html:text struts tags and
setting appropriate properites:

<html:text property="zipCode"/>

This assumes your testForm has a getter/setter for zipCode.

Hope this helps.

ATTA




On 10/24/05, Asad Habib <[EMAIL PROTECTED]> wrote:

Hello. I am new to Struts and 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