Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

jsp:getProperty returning empty string

843838Sep 13 2006 — edited Sep 14 2006
Hi All,

I have the following code:
<%@ page import="java.util.Vector, DTO.StaffDTO"%>

<html>
 <head>
  <title> Staff Details </title>
  <script>
   function SendToServer( pageIndex)
   {
    document.forms[0].action = "LoadRecords?page=" + pageIndex;
    document.forms[0].submit();
   }
  </script>
 </head>
 <body>
  <jsp:useBean id="myBean" scope="page" class="DTO.StaffDTO"/>
  <form method="post">
   <table border=1>
    <tr>
     <td>Employee ID</td>
     <td>Name</td>
     <td>Department</td>
    </tr>
    <%
       Vector objResults = (Vector)request.getAttribute( "Results");
       objResults.trimToSize();
       int ctr = 0;
       while( ctr < objResults.size())
       {
     %>
     <tr>
      <td><jsp:getProperty name="myBean" property="name"/></td>
      <td><jsp:getProperty name="myBean" property="customerID"/></td>
      <td><jsp:getProperty name="myBean" property="balance"/></td>
     </tr>
     <%
       ctr++;
       }
     %>
     <%
       int objTotalRecords = ((Integer)request.getAttribute( "TotalRecords")).intValue();
     %>
     <tr>
       <%
         int pageIndex = 0;
         while( (pageIndex * 10) <= objTotalRecords)
         {
       %>
       <td align=right>
        <a href="javascript:SendToServer(<%=pageIndex+1%>);"><%=pageIndex + 1%></a>
       </td>
       <%
          pageIndex++;
         }
       %>
      </td>
     </tr>
   </table>
  </form>
 </body>
</html>
What happens here is that <jsp:getProperty> tags return empty strings. I put some SOPs in the file where the values are extracted from the DB and put into the bean. The values are correctly retrieved and they are stored into the bean. Then what could be causing this problem?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 12 2006
Added on Sep 13 2006
7 comments
468 views