aspose file tools*
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
Author

Passing different values to Bean from JSP

Madhusudhan GoturKaranam
Greenhorn

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) {
this.Name=CName;this.Address=address;
this.HNum=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
Greenhorn

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.
-Randy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing different values to Bean from JSP