aspose file tools*
The moose likes Servlets and the fly likes Problem with jsp:useBean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem with jsp:useBean" Watch "Problem with jsp:useBean" New topic
Author

Problem with jsp:useBean

Asuthosh Borikar
Ranch Hand

Joined: Sep 29, 2000
Posts: 75
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?
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
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

Joined: Sep 29, 2000
Posts: 75
I did that and it works fine now. Thanks Peter.(For your answer to my question and for your motivation).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with jsp:useBean