You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Paul Benedict <pa...@yahoo.com> on 2006/02/04 07:37:25 UTC

Struts Form Population

When struts auto populates the form, does it look for set methods? And  does it check that the methods are public? For instance, if the "foo"  parameter comes in and my setFoo method is protected or private, will  it ignore it?
  
  Paul
  
		
---------------------------------
Brings words and photos together (easily) with
 PhotoMail  - it's free and works with Yahoo! Mail.

Re: Struts Form Population

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Hi Paul,

The question is really what will BeanUtils do because Struts uses 
BeanUtils to populate the form.

Looking at the docs, I see this:

java.lang.IllegalAccessException - if the caller does not have access to 
the property accessor method
java.lang.IllegalArgumentException - if bean or name is null
java.lang.reflect.InvocationTargetException - if the property accessor 
method throws an exception
java.lang.NoSuchMethodException - if an accessor method for this propety 
cannot be found

...in the docs for PropertyUtilsBean.setProperty(), which is I believe 
what is ultimately used to set a given property.  So, my bet is you'd 
get IllegalAccessException thrown, or possibly NoSuchMethodException.

Then again, there *is* IIRC some special handling for read-only 
properties, and I would think that is determined by whether there is an 
accessible getter.

Well, I suppose in the end I'm not really sure what the answer is 
without actually testing it, but BeanUtils is where you should be 
looking in any case :)

Frank

Paul Benedict wrote:
> When struts auto populates the form, does it look for set methods? And  does it check that the methods are public? For instance, if the "foo"  parameter comes in and my setFoo method is protected or private, will  it ignore it?
>   
>   Paul
>   
> 		
> ---------------------------------
> Brings words and photos together (easily) with
>  PhotoMail  - it's free and works with Yahoo! Mail.
> 
> 
> ------------------------------------------------------------------------
> 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.375 / Virus Database: 267.15.0/249 - Release Date: 2/2/2006

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: fzammetti@hotmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: [SPAM] Re: Struts Form Population

Posted by Jitendra Kumar <ji...@hth.bhel.co.in>.
I didn't receive any content in the mail. Please re send you mail.

thanx

-----Original Message-----
From: Dakota Jack [mailto:dakota.jack@gmail.com] 
Sent: Sunday, February 05, 2006 11:36 AM
To: Struts Users Mailing List
Subject: [SPAM] Re: Struts Form Population



----------------------------------------- (on hth.bhel.co.in)

email-body was scanned and no virus found
---------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts Form Population

Posted by Dakota Jack <da...@gmail.com>.
You can do what Frank suggests, which I agree with in total, or you can just
try it and see what happens.  Probably is quicker to try it and see than to
ask on this list.

On 2/3/06, Paul Benedict <pa...@yahoo.com> wrote:
>
> When struts auto populates the form, does it look for set methods?
> And  does it check that the methods are public? For instance, if the
> "foo"  parameter comes in and my setFoo method is protected or private,
> will  it ignore it?
>
>   Paul
>
>
> ---------------------------------
> Brings words and photos together (easily) with
> PhotoMail  - it's free and works with Yahoo! Mail.
>



--
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~