You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mi...@honeywell.com on 2002/06/05 04:55:01 UTC

2 problems that are just driving me CRAZY

Hi,

I'm having two problems which are sure to drive me out of my mind if I don't
find the solution soon.  If you can help with either one of these, I would
appreciate it.

1) For my problem, let's say I have 2 actions with 2 forms called ActionA,
ActionB, FormA, and FormB.  ActionA is going to use FormA and ActionB is
going to use FormB.  But, for some reason, the jsp which displays FormB
actually tries to display FormA.  I know this because FormA has an attribute
called transactionMonth and FormB has an attribute called monthSelection.
When I try to run this, I get an exception which tells me that there is no
getter for monthSelection.  However, if I go into my jsp and change it to
transactionMonth (from Form A), it works without a hitch.  ActionB does get
FormB though.  I know this because if I do a "servlet.log(form);" in
ActionB, I get the full pathname for FormB.  This problem occurs when I
forward to ActionB/FormB (not when I do a submit, I haven't tried that yet).

2) My second problem I've had trouble with longer.  It has to do with
ActionErrors and using the <html:errors/> tag.  In one branch of my webapp,
this works just fine.  But, for no reason that I can see, along another
branch of my webapp, the error message is not displayed.  I do the exact
same thing in both cases: I detect an error, add it to the errors
collection, do a SaveErrors method call, and forward using getInput().  In
both cases, the input form is re-displayed, but in one case the error
message is displayed and in the other case it's not.  The only other
discrepency that I see, which is also annoying, is that in the case where
the error does display, the input fields get cleared and they are all blank.
In the case where the error message is not dispalyed, the input fields
contain the values which were entered prior to the submit.

Thanks for your help,

Mike Witt

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: 2 problems that are just driving me CRAZY

Posted by Dan Hensgen <dh...@iplicity.com>.
2nd problem:

I'm assuming you are doing some validation or error handling in the action 
itself.  I'm not sure if it's convenient (or even possible) for your 
application, but you might have better luck moving all validation into the 
ActionForm for those mappings so that when the Action is performed (assuming 
the form validated ok), there is no reason for it not to work (and if it 
doesn't, treat it as a fatal error).

-Dan

> Hi,
> 
> I'm having two problems which are sure to drive me out of my mind if I
> don't
> find the solution soon.  If you can help with either one of these, I
> would
> appreciate it.
> 
> 1) For my problem, let's say I have 2 actions with 2 forms called
> ActionA,
> ActionB, FormA, and FormB.  ActionA is going to use FormA and ActionB
> is
> going to use FormB.  But, for some reason, the jsp which displays
> FormB
> actually tries to display FormA.  I know this because FormA has an
> attribute
> called transactionMonth and FormB has an attribute called
> monthSelection.
> When I try to run this, I get an exception which tells me that there is
> no
> getter for monthSelection.  However, if I go into my jsp and change it
> to
> transactionMonth (from Form A), it works without a hitch.  ActionB does
> get
> FormB though.  I know this because if I do a "servlet.log(form);" in
> ActionB, I get the full pathname for FormB.  This problem occurs when
> I
> forward to ActionB/FormB (not when I do a submit, I haven't tried that
> yet).
> 
> 2) My second problem I've had trouble with longer.  It has to do with
> ActionErrors and using the <html:errors/> tag.  In one branch of my
> webapp,
> this works just fine.  But, for no reason that I can see, along
> another
> branch of my webapp, the error message is not displayed.  I do the
> exact
> same thing in both cases: I detect an error, add it to the errors
> collection, do a SaveErrors method call, and forward using getInput(). 
> In
> both cases, the input form is re-displayed, but in one case the error
> message is displayed and in the other case it's not.  The only other
> discrepency that I see, which is also annoying, is that in the case
> where
> the error does display, the input fields get cleared and they are all
> blank.
> In the case where the error message is not dispalyed, the input fields
> contain the values which were entered prior to the submit.
> 
> Thanks for your help,
> 
> Mike Witt
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: 2 problems that are just driving me CRAZY

Posted by Adam Hardy <ad...@cyberspaceroad.com>.
Hi Mike
the first problem: how are you forwarding to ActionB from ActionA? Have 
you got a forward element to ActionB in your ActionMapping for ActionA 
set up in your struts-config, i.e.

  <action-mappings>
    <action    path="/myactiona"
               type="ActionA"
               name="FormA"
              scope="request"
           validate="true"
              input="/actiona.jsp">
      <forward name="do_actionb"       path="/myactionb.do"/>
    </action>


mike.witt@honeywell.com wrote:

>Hi,
>
>I'm having two problems which are sure to drive me out of my mind if I don't
>find the solution soon.  If you can help with either one of these, I would
>appreciate it.
>
>1) For my problem, let's say I have 2 actions with 2 forms called ActionA,
>ActionB, FormA, and FormB.  ActionA is going to use FormA and ActionB is
>going to use FormB.  But, for some reason, the jsp which displays FormB
>actually tries to display FormA.  I know this because FormA has an attribute
>called transactionMonth and FormB has an attribute called monthSelection.
>When I try to run this, I get an exception which tells me that there is no
>getter for monthSelection.  However, if I go into my jsp and change it to
>transactionMonth (from Form A), it works without a hitch.  ActionB does get
>FormB though.  I know this because if I do a "servlet.log(form);" in
>ActionB, I get the full pathname for FormB.  This problem occurs when I
>forward to ActionB/FormB (not when I do a submit, I haven't tried that yet).
>
>2) My second problem I've had trouble with longer.  It has to do with
>ActionErrors and using the <html:errors/> tag.  In one branch of my webapp,
>this works just fine.  But, for no reason that I can see, along another
>branch of my webapp, the error message is not displayed.  I do the exact
>same thing in both cases: I detect an error, add it to the errors
>collection, do a SaveErrors method call, and forward using getInput().  In
>both cases, the input form is re-displayed, but in one case the error
>message is displayed and in the other case it's not.  The only other
>discrepency that I see, which is also annoying, is that in the case where
>the error does display, the input fields get cleared and they are all blank.
>In the case where the error message is not dispalyed, the input fields
>contain the values which were entered prior to the submit.
>
>Thanks for your help,
>
>Mike Witt
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>  
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>