Actually, I didn't have any missing closing tags.  Adding scope to saveTestPage action 
map, I was able to get my testPage action working properly. 

>>> [EMAIL PROTECTED] 08/28/03 09:23AM >>>
What you cut and pasted suggested a typo of a missing closing slash before
the end of the action tag:

<action path="/saveTestPage" type="myaction.DummyAction"
input="/TestForm.jsp" name="testForm">

Should've been either:

<action path="/saveTestPage" type="myaction.DummyAction"
input="/TestForm.jsp" name="testForm"/>

OR

<action path="/saveTestPage" type="myaction.DummyAction"
input="/TestForm.jsp" name="testForm">
<!-- something could go here, forwards, set paramters, etc -->
</actino>

Regards,
David

-----Original Message-----
From: Srinivas Gunturu [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 28, 2003 10:05 AM
To: [EMAIL PROTECTED] 
Subject: Re: JSP not displaying data when in Edit Mode


I have resolved this issue.  But can not explain how it is fixed. :-)

Can any of the struts gurus out there shed some light on why this is so?

My struts-config.xml

        <form-beans>
                <form-bean name="testForm" type="mybean.TestForm" />
        </form-beans>

        <action-mappings>
            <action path="/testPage" type="myaction.TestAction"
                        attribute="testForm"
                               scope="request"
                        validate="false">
                <forward name="success" path="/TestForm.jsp"/>
            </action>

By replacing following line
            <action path="/saveTestPage" type="myaction.DummyAction"
input="/TestForm.jsp" name="testForm">
with
            <action path="/saveTestPage" type="myaction.DummyAction"
input="/TestForm.jsp" name="testForm" scope="request">
            </action>
        </action-mappings>


I was able to get my TestForm.jsp display data and get it into edit mode.
Though I am only trying to access http://localhost/myapp/testPage.do, I am
not sure why NOT HAVING SCOPE in /saveTestPage action made it not to display
data given in TestForm.

Any ideas?




>>> [EMAIL PROTECTED] 08/27/03 02:13PM >>>
All,

I am trying to get my JSP to display data from my form when in Edit mode.  I
am new to Struts and using Struts 1.1

I am not sure what I am doing wrong.  Any help or pointers at resources
would be appreciated.

I have included my struts-config, my jsp, my action class and my form class.

When I load my jsp, I am expecting to see "Filed1 value from action" in
"field1" as defined in the action class.  However, I am seeing the default
"Test Field1" as defined in the ActionForm class.

One thing I noticed is, my form is null in action execute class and I see
'Test Form is null.  Creating new one..." in the console.

Any idea what I am doing wrong?

TIA

- Srinivas

My JSP:

<[EMAIL PROTECTED] language="java" import="mybean.*"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:form action="saveTestPage">
Field 1 : <html:text property="field1" size="15"/><br />
Field 2 : <html:text property="field2" size="15"/>
<br />
<html:submit>Submit</html:submit>
</html:form>

My Form:

        private String field1;
        private String field2;

        public void reset(ActionMapping arg0, HttpServletRequest arg1) {
                field1 = "Test Field1";
                field2 = "Test Field2";
        }

        public String getField1() {
                return field1;
        }

        public String getField2() {
                return field2;
        }

        public void setField1(String field1) {
                this.field1 = field1;
        }

        public void setField2(String field2) {
                this.field2 = field2;
        }



My Action:

    public ActionForward execute(
        ActionMapping aMapping,
        ActionForm aForm,
        HttpServletRequest aRequest,
        HttpServletResponse aResponse) {

        HttpSession session = aRequest.getSession();

                if ( aForm == null ) {
                        System.out.println("Test Form is null.  Creating new one...");
                        aForm = new TestForm();
                }

        TestForm testForm = (TestForm) aForm;
        testForm.setField1("Filed1 value from action");
        testForm.setField2("Field2 value from action");

        if ("request".equals(aMapping.getScope())) {
                aRequest.setAttribute(aMapping.getAttribute(), testForm);
        }
        else {
            session.setAttribute(aMapping.getAttribute(), testForm);
        }

        return aMapping.findForward(Constants.SUCCESS);

}


My struts-config.xml

        <form-beans>
                <form-bean name="testForm" type="mybean.TestForm" />
        </form-beans>

        <action-mappings>
            <action path="/testPage" type="myaction.TestAction"
                        attribute="testForm"
                               scope="request"
                        validate="false">
                <forward name="success" path="/TestForm.jsp"/>
            </action>
            <action path="/saveTestPage" type="myaction.DummyAction"
input="/TestForm.jsp" name="testForm">
            </action>
        </action-mappings>






---------------------------------------------------------------------
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] 


---------------------------------------------------------------------
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