Try this to autonmatically set ALL properties from a form to a bean.

Note:
The FORM "name" must be the same as the instance variable in your bean. Make
sure you have the same case in the name as you do in the variable. Your
example below has property="ShopperRefNo" and your example has
"shopper_refno" these don't map correctly.

<jsp:setProperty name="shiptoBean" property="*" />

IF your form has names of
firstName
lastName
address
city
country
zipcode

and your bean has the EXACT same variables..
ex:
String firstName;
String lastName;
String address;
String city;
String country;
String zipcode;

Then the jsp:setProperty directive above will populaet all your variabes int
he bean automatically.

Also don't forget to make the 'set and get' methods for all your variables.

Hope this helps.

> -----Original Message-----
> From: Sushil Singh [mailto:[EMAIL PROTECTED]]
> Sent: Monday, October 23, 2000 6:50 PM
> To: [EMAIL PROTECTED]
> Subject: Bean - Unable to setProperty
>
>
> Hi,
>
> I am unable to setProperty for a bean, its giving error:
> com.sun.jsp.JspException: "setProperty(shiptoBean): Cant Find
> the method
>
> for setting {1}"
>
> Following is the code snippet:
> <jsp:setProperty name="shiptoBean" property="dbUser"
> value="db2inst1"/>
>
> <jsp:setProperty name="shiptoBean" property="ShopperRefNo"
> value="17338459"/>
>
> Bean code is something like this:
> private String dbUser = "";
> private String shopper_refno = "";
> public void   setDbUser(String user)         { dbUser = user; }
> public String getDbUser()                        { return dbUser; }
> public void   setShopperRefNo(String shrfno) { shopper_refno
> = shrfno; }
>
> public String getShopperRefNo()              { return shopper_refno; }
>
> Also I would like to know how to specify setProperty so that
> all the set
>
> methods of beans should be automatically filled by form
> parameter or if
> url is called with paramters.
>
> Thanks,
>
> Sushil
>
> ______________________________________________________________
> _____________
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to