This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Servlets and the fly likes JSP: Passing object to a bean using setter method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "JSP: Passing object to a bean using setter method" Watch "JSP: Passing object to a bean using setter method" New topic
Author

JSP: Passing object to a bean using setter method

Ayaz Khaja
Greenhorn

Joined: Feb 16, 2001
Posts: 4
Is it possible to pass a java object to a bean using setter method through a JSP page?
<jsp:useBean id="cashier" scope="page" class="cart.Cashier" />
<jsp:setProperty
name="cashier"
property="cart"
param="cart" />
I am trying to accomplish this using the above code in a JSP page and I get the following error on JSWDK:1.0.1:
JspException: setProperty: variable of Class: class cart.ShoppingCart can't be set.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12682
    
    5
I don't think setProperty works that way. Why not just write the normal Java code to pass the object?
Bill

Java Resources at www.wbrogden.com
Ayaz Khaja
Greenhorn

Joined: Feb 16, 2001
Posts: 4
I guessed so. Thanks for your reply Bill.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP: Passing object to a bean using setter method
 
Similar Threads
Bean setter methods........
Problem in injecting interface
show cart in shopping cart
How to display the resulting JSP of a servlet in another frame?
Strange problem in retrieving the table data in a jsp