wood burning stoves 2.0*
The moose likes JSP and the fly likes Passing different values to Bean from JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Passing different values to Bean from JSP" Watch "Passing different values to Bean from JSP" New topic

Passing different values to Bean from JSP

Madhusudhan GoturKaranam

Joined: Dec 31, 2002
Posts: 4
I have a Bean class like Below.
public class Test
String Name;String Address;int HNum;
public void setName(String CName, String address, int hnum) {
public String getName() {
return Name + Address + Integer.toString(HNum);
And from JSP i need to set the values using <jsp:setProperty> for all above three parameters(CName,address,hnum)and get those values using <jsp:getProperty>.
Please Help me in this regard.
Randy Motluck

Joined: Jul 19, 2002
Posts: 10
If you use a property "name" in the jsp, you should have a method "setName" that only takes one argument, the name to set. If you want the address, you should have a property called address and use a method called "setAddress" with only one argument as well. It should be the address to set.
That's it. The jsp can glean the correct method name from the propery name.
Consider Paul's rocket mass heater.
subject: Passing different values to Bean from JSP
Similar Threads
Creating an editable table using an array of input tags
jsp:getProperty gives null
reagarding jsp problem