Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Error using c:set for javaBean property  RSS feed

 
Phil Kurian
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I'm having a bit of trouble using the jstl c:set command for setting properties on javaBeans.

The jsp I've written is as below. The bean I'm using has a single property called "name" and it's a String. The relevant public getters and setters have been written





Unfortunately I get the following error in Tomcat

org.apache.jasper.JasperException: Invalid property in <set>: "name"

As far as I can tell the JSP can access the bean, as I am able to use the jsp:setProperty and jsp:getProperty methods successfully.

Could anyone give me some direction on what I'm doing wrong?

thanks
[ July 10, 2006: Message edited by: Phil Kurian ]
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The target object must evaluate to Object of type bean.

Try this

<c:set value="PK676" target="${phil}" property="name" />

Thanks
 
Phil Kurian
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Narendra,

It worked perfectly.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!