It's not a secret anymore!
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

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.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Passing different values to Bean from JSP
jQuery in Action, 3rd edition