To quote Fawcette-
"It doesn't take much to be a bean. A class just needs a public constructor
that takes no arguments and get and set methods for each significant
property such that a property named foo will have getFoo() and setFoo()
methods. Technically, it must just support introspection, but that is
usually achieved by using the get and set naming convention. Here is a
simple Stuff bean for our experiments that has a String and an integer for
properties
public class Stuff {
private int k = 1;
private String s = "hello";
public Stuff() {}
public int getK() {return k;}
public String getS(){return s;}
public void setK(int i) {k=i;}
public void setS(String t){s=t;}
};"
/*I noticed that I did not see your properties break out to a separate Bean
Classwith a public constructor as well as get/set for each property*/
HTH,
Martin
----- Original Message -----
From: "Jim Barrows" <[EMAIL PROTECTED]>
To: "Struts User List (E-mail)" <[EMAIL PROTECTED]>
Sent: Friday, September 03, 2004 1:02 PM
Subject: ARRRGGGGHHHH!!! I'm being stupid again....
I'm trying to use the set-property tag in the struts-config file. I know
I'm being stupid, but what exactly is it?
It's not finding the property to set.
Okay if I have in my struts-config.xml:
<action name="loanForm" path="/loanAppWizard"
type="com.sssc.shtuff.actions.LoanAppWizardAction" scope="session">
<set-property property="maxNumberOfPages" value="2" />
<forward name="page1" path="/demographics.jsp"></forward>
<forward name="page2" path="/references.jsp"></forward>
<forward name="done" path="/done.jsp"></forward>
</action>
and this in my action class:
public class LoanAppWizardAction extends Action {
blah
/**Read only property from inside this action that indicates what number
is
* the last page.
*/
private int maxNumberOfPages = 0;
Lots o' blah
/**
* @return
*/
public int getMaxNumberOfPages() {
return maxNumberOfPages;
}
public void setMaxNumberOfPages(int i) {
maxNumberOfPages = i;
}
}
Then I should end up with maxNumberOfPages set to 2, and not:
The following exception was logged java.lang.NoSuchMethodException: Bean has
no property named maxNumberOfPages
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]