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?