You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Siping Liu <sl...@egenera.com> on 2001/03/21 15:49:26 UTC

weird problem with Action.java

Hi,

I'm upgrading to Struts1.0 from 0.5 and see a weird problem:
I have my action class extends Action instead of ActionBase,
and still use the perform() method with 5 parameters (the first
one is servlet). It compiles. But when the action is invoked, I
get browser message "the page contains no data...", and I'm
sure the perform() method isn't called (I have a printout on first
line). It works only after I removed the servlet parameter to
perform().

I checked Struts source code and don't see any problem. Anyone
see why this happens?

Thanks,
S Liu


Re: weird problem with Action.java

Posted by Jean-Noel Ribette <je...@improve.fr>.
Looking at the source code of beta1 the ActionServlet never calls the perform method with the servlet parameter and 5
argument:

ActionServlet.doGet calls process(HttpServletRequest, HttpServletResponse) which at some point call
processActionPerform(Action, ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse). This last method calls
the method perform with the mapping attribute and not the one with the servlet attribute.

I think you need to subclass ActionServlet if you still want the perform method with the servlet parameter to be called,
but the best think would be to use the perform method without the servlet parameter.

Jean-Noel

> Hi,
>
> I'm upgrading to Struts1.0 from 0.5 and see a weird problem:
> I have my action class extends Action instead of ActionBase,
> and still use the perform() method with 5 parameters (the first
> one is servlet). It compiles. But when the action is invoked, I
> get browser message "the page contains no data...", and I'm
> sure the perform() method isn't called (I have a printout on first
> line). It works only after I removed the servlet parameter to
> perform().
>
> I checked Struts source code and don't see any problem. Anyone
> see why this happens?
>
> Thanks,
> S Liu
>
>


Re: weird problem with Action.java

Posted by Siping Liu <sl...@egenera.com>.
Actually I see what's going on:
ActionServlet.java is calling Action.perform() with 4 parameters in
processActionPerform(). Since I don't have a perform() with 4 param
defined, it uses the default one in Action.java that returns null.

For backward compatibility, it looks like we should modify Action.java,
and have the default perform(4 param) calls perform(5 param), not
another way around
as we have now.

Siping Liu wrote:

> Hi,
>
> I'm upgrading to Struts1.0 from 0.5 and see a weird problem:
> I have my action class extends Action instead of ActionBase,
> and still use the perform() method with 5 parameters (the first
> one is servlet). It compiles. But when the action is invoked, I
> get browser message "the page contains no data...", and I'm
> sure the perform() method isn't called (I have a printout on first
> line). It works only after I removed the servlet parameter to
> perform().
>
> I checked Struts source code and don't see any problem. Anyone
> see why this happens?
>
> Thanks,
> S Liu