• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Problem with jsp:useBean

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am learning JSP, on Weblogic Server 5.1.0
One of my test JSPs contain the following code:
<jsp:useBean id="testBean" class="com.code.TestBean"/>
<jsp:setProperty name="testBean" property="name" value="ABCXYZ"/>
<jsp:setProperty name="testBean" property="count" value="200"/>
<BR>
<B>NAME</B> is : <jsp.getProperty name="testBean" property="name"/>
<BR>
<i>NAME</i> is : <%=testBean.getName()%>
<BR>
<B>COUNT</B> is : <jsp.getProperty name="testBean" property="count"/>
<BR>
<i>COUNT</B> is:<%=testBean.getCount()%>
Where TestBean is a regular Java Class, with private attributes int count, and String name, and public methods to set and get them.
The result of executing this JSP is:
NAME is :
NAME is : ABCXYZ
COUNT is :
COUNT is:200
It's obvious that Bean is being created and the properties are being set. But, when I use getProperty it's failing, although it works if I use a regular JSP Expression.
What am I missing here? Could some one please help me?
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Asuthosh Borikar:
What am I missing here? Could some one please help me?


Try <jsp:getProperty>. Note colon instead of dot. These things happen to the best of us
- Peter

 
Asuthosh Borikar
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did that and it works fine now. Thanks Peter.(For your answer to my question and for your motivation).
 
We don't have time for this. We've gotta save the moon! Or check this out:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic