It seems like my action is being executed twice when called, and the jsp
that it forwards to is submitted once right when the action is called.  I
created a very simple setup just to isolate this problem.

I know this can't be right b/c I couldn't find archive of anyone else having
similar problem, so I must have some config problem.  That, or I don't
understand the struts process flow.

I say that the jsp is getting submitted b/c if I type in "ANYTEXT" in field1
submit it, my log looks like this:
    2002-03-03 03:20:08,079 [tcpConnection-80-0] DEBUG beans.EnterBean  -
creating enterbean
    2002-03-03 03:20:08,149 [tcpConnection-80-0] DEBUG struts.EnterAction  -
EnterAction field1: ANYTEXT field2:
    2002-03-03 03:20:08,279 [tcpConnection-80-0] DEBUG beans.EnterBean  -
creating enterbean
    2002-03-03 03:20:08,279 [tcpConnection-80-0] DEBUG struts.EnterAction  -
EnterAction field1: null field2: null

Then, if I refresh (not submit), it looks the same, with ANYTEXT appearing
again.

Why is EnterBean created and EnterAction executed twice?  And why does
field1 in the first created bean retain the text, then go null?  How could
field1 even know about the previous entry unless it was processing the jsp
on the first action execution?

Relevant parts of struts.xml are straightforward:
    <form-bean name="enterBean" type="beans.EnterBean"/>

    <action     path="/enter"
                type="struts.EnterAction"
                name="enterBean"
                scope="request"
                validate="false">
      <forward  name="enter" path="/enter.jsp"/>
    </action>

My EnterAction class  execute() has only the following code:
     EnterBean bean = (EnterBean)form ;
     CAT.debug("EnterAction"
              + " field1: " + bean.getField1()
              + " field2: " + bean.getField2()
              ) ;
    return mapping.findForward("enter") ;

The EnterBean has getters/setters for Field1 and 2, and constructor has only
the following:
    public EnterBean()  {
      if (CAT.isDebugEnabled())
        CAT.debug("creating enterbean") ;
    }

And enter.jsp has basically this:
    <html:form action="/enter">
      <table width="100%">
        <tr>
          <td>
            <html:text property="field1" />
          </td>

Mike


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

Reply via email to