struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amleto Di Salle" <>
Subject R: R: Turning OFF auto form population?
Date Wed, 19 May 2004 18:30:05 GMT
you are right when you said "...I'd like to avoid doing that...", but
unfortunely the only possible solution is to extend the RequestProcessor
and override the processPopulate() method.

Maybe the solution is to eliminate the RequestUtils.populate inside the
processPopulate() method, i.e
protected void processPopulate(HttpServletRequest request,
HttpServletResponse response, ActionForm form, ActionMapping mapping)
throws ServletException {

        if (form == null) {

        // Populate the bean properties of this ActionForm instance
        if (log.isDebugEnabled()) {
            log.debug(" Populating bean properties from this request");
        form.reset(mapping, request);
        if (mapping.getMultipartClass() != null) {
        RequestUtils.populate(form, mapping.getPrefix(),
        // Set the cancellation request attribute if appropriate
        if ((request.getParameter(Constants.CANCEL_PROPERTY) != null) ||
            (request.getParameter(Constants.CANCEL_PROPERTY_X) != null))
            request.setAttribute(Globals.CANCEL_KEY, Boolean.TRUE);


The other thing to do is to configure the strut-config.xml, i.e.

<controller processorClass="com.pincopallo.RequestProcessorExtended"/>


-----Messaggio originale-----
Da: None None [] 
Inviato: mercoledì 19 maggio 2004 20.08
Oggetto: RE: R: Turning OFF auto form population?

That's interesting, I knew Struts was designed to be extended in a
number of 
places, I hadn't thought of doing that... However, I've purposely NOT 
extended it in some other places, and I'd like to avoid doing that, just

from a philosophical point of view (i.e., unless I have a real good
to, it's probably less complex to use the Struts classes as-is).  It's a

thought though.

You raise an interesting point about the name attribute though... I know
can just leave it out, and then I'll be responsible for instantiating
ActionForm and putting it in request to return to the view (which is
our homegrown framework does).  I was thinking that I would let Struts 
instantiate it for me, and send it to the view for me, then I can remove

some code that would at that point be superfolous.  But, your point is a

good one: since the code is doing it already, I can just NOT specify an 
ActionForm for the Actions, then it wouldn't matter what class I extend
from.  That would do the trick.

But, I still at some future point would have to go back into 
struts-config.xml and put the name attribute back in becuase presumably
going to want to do that eventually (and I in fact do).  So, although
you point out is a solution I can use, I'd still like to know if there
is a 
way I can get the benefit of Struts handling the creation of the
and the passing it to the view for me WITHOUT having it auto-populate it
the way in.  That's still i think the ideal situation for me, if it's 
possible, so the question still stands.

>From: "Amleto Di Salle" <>
>Reply-To: "Struts Users Mailing List" <>
>To: "'Struts Users Mailing List'" <>
>Subject: R: Turning OFF auto form population?
>Date: Wed, 19 May 2004 19:59:16 +0200
>but have you used in the action tag inside the "struts-config.xml" the 
>"name" attribute?
>Anyway, if I understood correctly, you can always extend the 
>RequestProcessor class and override the processPopulate(...) method.
>Furthermore, you have to configure struts to use the extended 
>RequestProcessor version.
>-----Messaggio originale-----
>Da: None None []
>Inviato: mercoledì 19 maggio 2004 19.33
>Oggetto: Turning OFF auto form population?
>Hello all... Is it possible to turn OFF Struts auto-populating an 
>ActionForm with the paramters from the client?
>The reason I ask is that I'm converting a non-Struts app over, and in 
>this app, because it was using a homegrown framework, we have value 
>object classes which are basically exactly what ActionForms are, except

>that they
>are NOT auto-popualated.  The problem is that some of the getter and
>method names may not match the input parameters, and rather than trying
>go through it all and change the names to match (which I can do as a
>step), I'd like to turn off the auto-populate function if I can.
>If I can't, I can just leave these classes as-is and just have them not

>extend ActionForm... since they are always manually dealt with, that's 
>not a problem, but if I can make make them extend ActionForm and turn 
>off the auto-populate, then I can just swing back around in a later 
>iteration and
>make the changes I need to then.
>Thanks all!
>FREE pop-up blocking with the new MSN Toolbar – get it now! 
>To unsubscribe, e-mail:
>For additional commands, e-mail:
>To unsubscribe, e-mail:
>For additional commands, e-mail:

FREE pop-up blocking with the new MSN Toolbar – get it now!

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message